Nmap Development mailing list archives
Re: Rounding of OS match percentages differs between architectures
From: David Fifield <david () bamsoftware com>
Date: Thu, 20 Nov 2008 10:19:43 -0700
On Wed, Nov 19, 2008 at 06:26:22PM -0700, David Fifield wrote:
On Wed, Nov 19, 2008 at 07:54:14PM -0500, Michael Pattrick wrote:On Wed, Nov 19, 2008 at 6:32 PM, David Fifield <david () bamsoftware com> wrote:Nmap currently uses printf("%d%%", (int) (frac * 100)) to show match percentages. Using printf("%.f%%", frac * 100) would remove this problem but would create another, namely that everything 99.5% and above would be rounded to 100%. Anyone have an opinion on this or see a good way to handle it?If I understand the problem properly - you want to strip the decimals, why not just use floor()?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.
r11133 has this fix. David Fifield _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- Rounding of OS match percentages differs between architectures David Fifield (Nov 19)
- Message not available
- Re: Rounding of OS match percentages differs between architectures David Fifield (Nov 19)
- Re: Rounding of OS match percentages differs between architectures jah (Nov 19)
- Re: Rounding of OS match percentages differs between architectures Brandon Enright (Nov 19)
- Re: Rounding of OS match percentages differs between architectures Brandon Enright (Nov 19)
- Re: Rounding of OS match percentages differs between architectures sara fink (Nov 23)
- Re: Rounding of OS match percentages differs between architectures Toni Ruottu (Nov 24)
- Re: Rounding of OS match percentages differs between architectures David Fifield (Nov 19)
- Message not available
- Re: Rounding of OS match percentages differs between architectures DePriest, Jason R. (Nov 19)
- Re: Rounding of OS match percentages differs between architectures Michael Pattrick (Nov 19)
- Re: Rounding of OS match percentages differs between architectures David Fifield (Nov 20)