Implement the "unum" representation in D ?

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 18 02:24:58 PDT 2015


On Thursday, 17 September 2015 at 23:53:30 UTC, Anthony Di Franco 
wrote:
> Whether this library should be part of the standard library, I 
> don't know. It would seem to depend on how much people want the 
> standard library to support verified numerical computing. If it 
> is clear that verified numerical computing needs good support 
> in the standard library, something like unums should be there, 
> maybe even with some other techniques built on top of them 
> (Taylor model or Levi-Civita for example).

I don't think you should expect D to support verifiable 
programming. The only person here that has pushed for it 
consistently is Bearophile, but he is not a dev (and where is 
he?).

Andrei has previously voiced the opinion that interval 
arithmetics as defined is ad-hoc and that D should do it 
differently:

http://forum.dlang.org/post/l8su3p$g4o$1@digitalmars.com

Walter, Andrei and many others have previously argued that you 
can turn asserts into assumes (basically assuming that they hold) 
without wrecking total havoc to the correctness of the program 
after optimization.

It has also been argued that signalling NaNs are useless and that 
reproducible floating point math (IEEE754-2008) is not going in 
based on some pragmatic assumptions that I never quite 
understood. The current definition of D floats is fundamentally 
incompatible with IEEE 754-2008. So I am not even sure if you can 
implement IEEE 1788 (interval arithmetics) as a plain D library.

D also only have modular integer math so you cannot detect 
overflow by adding a  compiler switch since libraries may depend 
on modular arithmetic behaviour.

D is created by hackers who enjoy hacking. They don't have the 
focus on correctness that verifiable-anything requires. So if you 
enjoy hacking you'll have fun. If are into reliability, stability 
and correctness you'll get frustrated. I'm not even sure you can 
have it both ways (both have a hacker mindset and a correctness 
mindset in the same design process).



More information about the Digitalmars-d mailing list