Floating point rounding modes: we should restrict them slightly

Stewart Gordon smjg_1998 at yahoo.com
Sun Sep 13 15:11:42 PDT 2009


Don wrote:
<snip>
>> Floating point settings are just another case of the same thing, 
>> except that currently violations in relation to the former are allowed.
> 
> There's a fundamental difference between them: the floating point 
> settings are a hardware feature and it is IMPOSSIBLE to avoid them.

Actually, you _can_ avoid changing the floating point settings in the 
course of an average program.  But still....

> You can choose not to use locale settings. Or, you can pass them as a 
> parameter, which doesn't work for floating point settings.

As long as it's the built-in arithmetic operators you're concerned 
about.  But that said, wrapping every arithmetic operation in a function 
to purify it of dependence on floating point settings wouldn't be ideal.

> Please do not get sidetracked on pure functions, it is orthogonal to 
> this issue.

I'm not sure about this.  ISTM arithmetic operators are essentially pure 
functions, and so the compiler may treat them as such.

Stewart.



More information about the Digitalmars-d mailing list