Which D features to emphasize for academic review article

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Aug 11 05:07:39 PDT 2012


On 8/11/12 3:11 AM, F i L wrote:
> I still prefer float class members to be defaulted to a usable value,
> for the sake of consistency with ints.

Actually there's something that just happened two days ago to me that's 
relevant to this, particularly because it's in a different language 
(SQL) and different domain (Machine Learning).

I was working with an iterative algorithm implemented in SQL, which 
performs some aggregate computation, on some 30 billions of samples. The 
algorithm is rather intricate, and each iteration takes the previous 
one's result as input.

Somehow at the end there were NaNs in the sample data I was looking at 
(there weren't supposed to). So I started investigating; the NaNs could 
appear only in a rare data corruption case. And indeed before long I 
found 4 (four) samples out of 30 billion that were corrupt. After one 
iteration, there were 300K NaNs. After two iterations, a few millions. 
After four, 800M samples were messed up. NaNs did save the day.

Although this case is not about default values but about the result of a 
computation (in this case 0.0/0.0), I think it still reveals the 
usefulness of having a singular value in the floating point realm.


Andrei


More information about the Digitalmars-d mailing list