Proposal: fixing the 'pure' floating point problem.

Joel C. Salomon joelcsalomon at gmail.com
Sat Mar 14 19:33:53 PDT 2009


Walter Bright wrote:
> Andrei Alexandrescu wrote:
>> 1. Is it usual to change the FP flags in an application multiple
>> times, or not? (I never changed them, so please be easy on me.)
> 
> Given a complex calculation, one might want to know how sensitive the
> result is to roundoff error. Calculating this exactly can be a daunting
> task, but you can get a rough-and-ready estimate of it by running the
> calculation 3 times:
> 
> 1. with round to nearest (the default)
> 2. with round up
> 3. with round down
> 
> and comparing the results. I don't really know of any other uses.

Implementing interval arithmetic:

	struct interval
	{
		real low;
		real high;

		interval opAdd(interval rhs)
		{
			return {this.low +!(roundDown) rhs.low,
				this.high +!(roundUp) rhs.high};
		}
	…
	}

On the 754r mailing list, the HPC crowd was *very* insistent that static
modes be explicitly in the standard. On some (hypothetical?)
architectures, the different rounding modes might translate to different
opcodes to the FPU rather than adding a “mode-change” instruction.

—Joel Salomon



More information about the Digitalmars-d mailing list