C++ Ranges proposal for the Standard Library

via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 17 22:54:00 PDT 2014


On Saturday, 18 October 2014 at 04:35:07 UTC, Walter Bright wrote:
>> 1. Compiled static languages still have a long way to go with 
>> expressiveness.
>
> D has closed that gap quite a bit.

Better than C++, but C++ is gaining ground with C++14.

> Or use the much-hated much-misunderstood 80 bit reals!

Yikes! Those are legacy and only help a little bit.

> In any case, just insert a .sort operation. It's still generic.

"generic"! But a .sort isn't enough since the accumulator leads 
to lost precision. To improve that you have to add pairs that are 
close in exponent, and keep iterating, but still some losses.

To do it right you could create 2048 accumulators (one for each 
exponent) and add the mantissas as integers. Not at all generic!

> 80 bit reals can compensate for a lot of loss-of-precision 
> issues.

Larger mantissa can help a little bit, but only a little bit. You 
would need a 2000 bits mantissa to do it with a large dataset 
with a wide range of values.

Doing perfect calculations with rational numbers and compare it 
to floating point is a nice exercise.


More information about the Digitalmars-d mailing list