delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/01/02:11:53

Date: Tue, 1 Aug 2000 09:10:32 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Radical NetSurfer <radsmail AT juno DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: modf BROKEN ??
In-Reply-To: <crdcosk167oh81vpnjfqeg1bnls5qqg9ld@4ax.com>
Message-ID: <Pine.SUN.3.91.1000801090852.13973C-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, 31 Jul 2000, Radical NetSurfer wrote:

> Why does the following program INCORRECTLY display
> the fractional part?

Please make a point of showing the faulty output, and please tell
exactly which part of it you think is incorrect, and why.  These
things are very hard to guess.

If your problem is with the output printed for the 11th line, where it
says "Value: 1.000000", then the reason is that adding 0.1 10 times
doesn't yield 1.0 (0.1 doesn't have an exact binary representation).
Try assigning 1.0 to v directly, and see the difference.

- Raw text -


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