float init 0 request

Walter Bright newshound2 at digitalmars.com
Tue Aug 18 19:16:36 UTC 2026


On 8/16/2026 1:32 AM, pete wrote:
> Most people would assume the default would just be zero and if you are going to 
> violate the principle of least surprise by making it different then the result 
> of using the nan should be immediate and obvious.

If 0.0 is the wrong initialization, then it is worse trying to detect the error.

For example,

0.001 + 0.0 => 0.001 => overlooked error

0.001 + NaN => NaN => obvious error


More information about the Digitalmars-d mailing list