Rounding error

Marco Bodrato bodrato at mail.dm.unipi.it
Fri Aug 27 15:47:25 UTC 2021


Ciao,

Il 2021-08-25 05:54 Frank Heckenbach ha scritto:
> mpf_get_str seems to round incorrectly sometimes.
> In this test program, the digits around 809 are "...244594553...",
> so it should round to "...244595", but it outputs "...244594".

Here, your report says that you expected a "rounded" result,
but you get a truncated one.

Il 2021-08-27 07:36 Frank Heckenbach ha scritto:
> Actually, what I wanted is truncation, not rounding. But AFAICS

Here, you say that you actually want truncation.

> there is no string conversion function with truncation (correct?),

 From the manual I read a general claim about functions using mpf:
"Final results are always truncated to the destination variable’s 
precision."
See https://gmplib.org/manual-6.2.1/Floating_002dpoint-Functions .

Do you have an example of the function not working as documented?

Ĝis,
m


More information about the gmp-bugs mailing list