Floating point rounding modes: we should restrict them slightly
Lionello Lunesu
lio at lunesu.remove.com
Thu Sep 10 16:18:35 PDT 2009
#ponce wrote:
> Why not imposing a rounding mode (ex : toward minus infinity) ?
> And then disallowing to change it in assembly.
>
> I mean, you can still do :
> round(x) as floor(x + 0.5L)
> ceil(x) as floor(x + 1.0L)
>
> Iit would cost some precision with large floating-point number, but not much since rounding such large numbers has few meaning.
>
> It would clear up the rounding-mode mess a bit.
Shouldn't ceil(1.0) return 1.0, and wouldn't floor(1.0 + 1.0L) return 2.0?
L.
More information about the Digitalmars-d
mailing list