On 16 May 2016 at 08:00, Ola Fosheim Grøstad via Digitalmars-d <[email protected]> wrote: > On Sunday, 15 May 2016 at 22:49:27 UTC, Walter Bright wrote: >> >> On 5/15/2016 2:06 PM, Ola Fosheim Grøstad wrote: >>> >>> The net result is that adding const/immutable to a type can change the >>> semantics >>> of the program entirely at the whim of the compiler implementor. >> >> >> C++ Standard allows the same increased precision, at the whim of the >> compiler implementor, as quoted to you earlier. >> >> What your particular C++ compiler does is not relevant, as its behavior is >> not required by the Standard. > > > This is a crazy attitude to take. C++ provides means to detect that IEEE > floats are being used in the standard library. C/C++ supports non-standard > floating point because some platforms only provide non-standard floating > point. They don't do it because it is _desirable_ in general. > > You might as well say that you are not required to drive on the right side > on the road, because you occasionally have to drive on the left. So > therefore it is ok to always drive on left. > >> My proposal removes the "whim" by requiring 128 bit precision for CTFE. > > > No, D's take on floating point is FUBAR. > > const float value = 1.30; > float copy = value; > assert(value*0.5 == copy*0.5); // FAILS! => shutdown >
This says more about promoting float operations to double than anything else, and has nothing to do with CTFE.
