Movement against float.init being nan

user1234 user12342 at 12.de
Thu Aug 25 09:07:54 UTC 2022


On Thursday, 25 August 2022 at 07:15:58 UTC, bauss wrote:
> On Thursday, 25 August 2022 at 03:08:54 UTC, Steven 
> Schveighoffer wrote:
>>
>> A better option would be to throw an exception if NaN is used 
>> in an operation.
>>
>> -Steve
>
> IMHO this is the better solution and not even an exception, but 
> Error.
>
> As soon as you have any NaN values that are being used your 
> program is effectively useless and broken.
>
> I think as soon as any variable becomes NaN it should throw, 
> not just when an operation happens.
>
> Basically I think it should throw when either of these 
> conditions holds true:
>
> - A value was initialized as NaN and used in an operation
> - A value was set to NaN outside of initialization
> - NaN is returned from a function (Even if not set to a 
> variable or anything.)

I'm shocked by this idea. What if I want high performance nothrow 
FP code ?



More information about the Digitalmars-d mailing list