www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/10/11/09:47:25

Message-ID: <000101c15258$c34715e0$2645ce84@ECETSP>
From: "Patrick Mitran" <pmitran AT tsp DOT ece DOT mcgill DOT ca>
To: <djgpp AT delorie DOT com>
References: <F145eVe0F7HcCPG6hi40000bb0a AT hotmail DOT com>
Subject: Re: GNU Multiprecission library
Date: Thu, 11 Oct 2001 08:35:03 -0400
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Reply-To: djgpp AT delorie DOT com

> could you please suggest a name for a library whose code is not very long,
> and that's all in C (again, not necessarily efficient!) we especially need
> the division, and modulo operators...

Why not just make the computer do long division (like you do it by hand) in
binary?
Its pretty easy since the divisor only ever fits in what you're dividing
either 0 or 1
times (compared to 0 to 9 times in decimal) and the algorithm only requires
right shifts and substractions. As a bonus, you get the remainder (modulus)
as well at the same time.

Patrick

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019