NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/59811: strpct round-off error



The following reply was made to PR lib/59811; it has been noted by GNATS.

From: mlelstv%serpens.de@localhost (Michael van Elst)
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: lib/59811: strpct round-off error
Date: Tue, 2 Dec 2025 13:58:09 -0000 (UTC)

 gnats-admin%NetBSD.org@localhost ("Martin Husemann via gnats") writes:
 
 >The following reply was made to PR lib/59811; it has been noted by GNATS.
 
 >From: Martin Husemann <martin%duskware.de@localhost>
 > On Tue, Dec 02, 2025 at 12:35:01AM +0000, Robert Elz via gnats wrote:
 > >  Maybe we need variants of str[s]pct() with a flags arg to indicate which
 > >  kind of rounding is desired, or would that be way over the top?
 > 
 > I would certainly expect it to work according to fenv(3)/fesetround(3)
 > global rounding mode.
 
 
 I wouldn't from a routine that explicitely says it does not use
 floating point arithmetic.
 
 str(s)pct is used by df and csh/time.
 
 I suggest to add a variant with explicit rounding mode (down/up/nearest/...),
 maybe change str(s)pct to use round-to-nearest (good for csh) and
 change df to use the round-up version to be compliant.
 


Home | Main Index | Thread Index | Old Index