Movement against float.init being nan

Witold witold.baryluk+dlang at gmail.com
Thu Oct 26 02:42:37 UTC 2023


On Thursday, 12 October 2023 at 09:54:33 UTC, cc wrote:
> On Friday, 26 August 2022 at 16:28:32 UTC, Steven Schveighoffer 
> wrote:
>> On 8/25/22 9:01 PM, Walter Bright wrote:
>>> On 8/25/2022 10:38 AM, Steven Schveighoffer wrote:
>>>> 0 is no better here *but also no worse*.
>>> 
>>> 0 is equal or worse than NaN. It is true that sometimes 0 is 
>>> equal. But it is *never* better.
>>
>> I fully don't ever expect any changes to come from this 
>> discussion. But just to continue the point here, yes, it's 
>> slightly better in *some cases*. The question to answer is 
>> *how many cases*, and is the pain caused by having to go 
>> correct problems that should never have existed in the first 
>> place worth fixing those few cases where it actually helps.
>
> At the end of the day, the answer is: Default initializing 
> floats to NaN is (very) arguably important to the niche 
> high-expertise line of work Walter engaged in, and *fairly 
> annoying* to the vast sea of untapped market potential and 
> prospective programmers D may or may not sorta-kinda-hope to 
> snag a share of someday, as its figurative hairline gradually 
> recedes trying to determine how best to balance being the 
> greatest wisest language in the world at certain arbitrary 
> vanishingly minor daily debugging issues while still providing 
> users with countless ways to freely shoot themselves in the 
> foot and crash their planes on weekends.
>
> It's all a weighting issue, and the weight has been placed on 
> the importance of the niche work over the some small percentage 
> of grumbling and stubbed toes the 
> different-from-how-everyone-else-does-it change incurs.

Niche maybe. Many other languages default initialize floats to 0 
(i.e. Go).

But NaN initialization on floats/double/complex did save me few 
times in the past, and allowed to actually be able to trace the 
problem, that I probably did not even knew I had otherwise.

I like NaN initialization. Just like I like null initialization 
for pointers.




More information about the Digitalmars-d mailing list