Nmap Development mailing list archives

Re: Rounding of OS match percentages differs between architectures


From: "DePriest, Jason R." <jrdepriest () gmail com>
Date: Wed, 19 Nov 2008 20:31:18 -0600

On Wed, Nov 19, 2008 at 7:26 PM, David Fifield <david () bamsoftware com> wrote:

Hey, thanks, that works! I guess I assumed that ((int) d) and floor(d)
would have the same result when d is positive. Apparently floor has
extra logic to know when its argument is less than but very close to an
integer.

(To see what I mean by "very close to," run python and type in "0.98". I
see "0.97999999999999998" as output.)

I wonder if this is really caused by the C library? Can anyone else
reproduce the "97% 98%" output from the test program I posted?

David Fifield

32-bit Windows compiled with cygwin's gcc 3.4.4
$ ./test
97% 98%

32-bit Debian Linux with Debian's gcc 4.3.2 package
$ ./test
97% 98%

I have a 64-bit processor but I am running 32-bit OSes.

-Jason

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: