Decimal string to floating point conversion with correct half-to-even rounding

Bruce Carneal bcarneal at gmail.com
Sat Aug 8 22:13:57 UTC 2020


On Saturday, 8 August 2020 at 18:16:30 UTC, Avrina wrote:
> On Friday, 7 August 2020 at 13:24:36 UTC, Andrei Alexandrescu 
> wrote:
>> On 7/7/20 8:04 AM, Steven Schveighoffer wrote:
>>> On 7/7/20 7:13 AM, 9il wrote:
>>>> On Tuesday, 7 July 2020 at 07:49:02 UTC, Walter Bright wrote:
>>>>> On 7/5/2020 5:46 AM, Joseph Rushton Wakeling wrote:
>>>>>> On Sunday, 5 July 2020 at 11:07:55 UTC, 9il wrote:
>>>>>>>
>>
>> FWIW it would be wisest to simply copy the code from Mir into 
>> druntime now with due credit. It's a minimally committal 
>> decision than can be easily revisited later. It is legal, 
>> appropriate, and there's no shame to it any more than it is 
>> for other projects to fork (parts of) dmd, druntime, or phobos.
>
> What's the purpose of that? If someone needs Mir, they can just 
> add it as a dependency in dub. This will just be adding more 
> bloat to drubtime. The development surrounding D seems to have 
> a stigma of using external dependencies even when there is 
> significant benefit. I find it odd that you bring up that 
> there's no shame to copy and paste. It seems the only reason 
> there simply wouldn't be a link to a dependency is because of 
> stigma. There's no shame relying on another project and you 
> don't have to copy and paste it. Optlink, DMC, DMC's club, etc. 
> Its gotten better than it was, but there's no reason to even 
> use any of those anymore, supporting them is just a waste of 
> time. As would maintaining a copy pasta of Mir would be.

Per the original post in this thread, the current compiler 
doesn't convert decimal floating point literals to binary form 
correctly in all normal cases.  Assuming people actually want to 
be correct/consistent to the last bit wherever possible, that 
should change.

Additionally, the default library conversions should match those 
of the compiler. They should also be correct/consistent.

This could be accomplished by introducing Mir dependencies in a 
few places but I think fully accredited copying is a better way 
to go.  There is more to maintain, true, but accurate conversion 
is fundamental in nature.  We're not talking about some high 
level library here.  Hard to get right? Apparently.  Esoteric?  
No.

As to timing, if the subnormal update Ilya mentioned is very 
close it would make sense to wait for that version.

Side note: the truly persnickety/paranoid might favor hex 
floating point literals but those are pretty hard on human 
readers.  At least the conversion implementations should not 
require heroics.








More information about the Digitalmars-d-announce mailing list