Hi Jan, On 2023-07-24 15:49, Jan Engelhardt wrote: > Signed-off-by: Jan Engelhardt <jengelh@xxxxxxx> > --- > man3/fmod.3 | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/man3/fmod.3 b/man3/fmod.3 > index ee2333fdc..a33b83eb5 100644 > --- a/man3/fmod.3 > +++ b/man3/fmod.3 > @@ -58,6 +58,9 @@ is the quotient of > / > .IR y , > rounded toward zero to an integer. > +.PP > +To obtain the modulus, more specifically, the Least Positive Residue, the > +expression "fmod(fmod(x, y) + y, y)" needs to be used. There's a more readable way (and it's probably also more efficient): <https://stackoverflow.com/a/2708900> I think it would be interesting to have an example program that shows both, and implements a function double lpr(double, double) that uses the branchy implementation. Thanks, Alex > .SH RETURN VALUE > On success, these > functions return the value \fIx\fP\ \-\ \fIn\fP*\fIy\fP, -- <http://www.alejandro-colomar.es/> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
Attachment:
OpenPGP_signature
Description: OpenPGP digital signature