Implementing Sparse Vectors With Associative Arrays/Compiler Bug?
Rene Zwanenburg
renezwanenburg at gmail.com
Thu Mar 7 15:21:37 PST 2013
On Thursday, 7 March 2013 at 09:43:21 UTC, jerro wrote:
>> Are errors of this magnitude to be expected using doubles, or
>> is this a compiler bug?
>
> Errors of this magnitude are to be expected. the value of accum
> in your example is somewhere around 3e+08, so the relative
> error is around 1e-15, and double.epsilon is 2.22045e-16.
This.
You can use reals to store the intermediary results. A real has
the largest hardware supported size, which is 80 bits for x87.
It's not a silver bullet but can be useful in cases like this.
More information about the Digitalmars-d
mailing list