bigfloat II

Don nospam at nospam.com
Thu Apr 9 22:36:57 PDT 2009


Walter Bright wrote:
> The rounding mode should be determined by reading the FPU's current 
> rounding mode.
> 
> 1. Two different systems for handling rounding is confusing and 
> excessively complicated.
> 
> 2. The FPU can be used for handling the lower precision calculations, 
> where it will use its rounding mode anyway.
> 
> 3. If specialized template versions of BigFloat will be the native 
> types, then they'll use the FPU rounding mode.
> 
> 4. No new API is necessary to get/set the modes.
> 
> 5. It'll respond appropriately when interfacing with code from other 
> languages that manipulate the FPU rounding modes.
> 
> This goes ditto for the floating point exceptions.

I'm not even sure how that should work. On x86, there are two completely 
independent FPU rounding modes and exception masks: one for x87, and one 
for SSE. Additionally, some of these may have rounding modes which 
aren't support by the others (almost all CPUs other than x87 have a 
flush-subnormals-to-zero mode; and in the IEEE spec, decimal floating 
point has two extra rounding modes that binary doesn't have).

What this means, I think, is that the D-supplied mechanism for 
controlling rounding mode and exceptions needs to be general enough to 
support them all.



More information about the Digitalmars-d mailing list