www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/28/13:46:30

From: martin AT loplop DOT com (Martin Peach)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: sprintf and 64 bit integers
Date: Tue, 28 Jul 1998 17:28:06 GMT
Organization: Communications Accessibles Montreal, Quebec Canada
Lines: 16
Message-ID: <35be0999.5920715@nntp.hip.cam.org>
References: <msg316796 DOT thr-3d13781 DOT f625b AT online DOT tietokone DOT fi> <35bdff5f DOT 3301382 AT nntp DOT hip DOT cam DOT org>
NNTP-Posting-Host: dialup-521.hip.cam.org
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Problem with that, yes:
You need to divide by 1000 raised to a power such that the largest
possible number will give you 999, then reduce the power by one each
pass through the loop until it gets to zero, which you use for the
last 3 digits..
Martin

>You could try dividing repeatedly by 1000 and sprinting out the
>numbers separated by commas:
>divide by 1000
>print the whole part of the result followed by a comma, except the
>last time.
>Subtract the whole part multiplied by 1000 from the original number.
>repeat.
>Martin.

- Raw text -


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