NaNs Just Don't Get No Respect

2012-08-17 Thread Walter Bright
Our discussion on this in the last few days inspired me to write a blog post about it: http://www.reddit.com/r/programming/comments/yehz4/nans_just_dont_get_no_respect/ http://www.drdobbs.com/cpp/nans-just-dont-get-no-respect/240005723

Re: NaNs Just Don't Get No Respect

2012-08-17 Thread bearophile
Walter Bright: http://www.drdobbs.com/cpp/nans-just-dont-get-no-respect/240005723 You have omitted the detail that double.nan !is double.init. On a more general note, I know many professionals in other fields that never write small articles about what they are doing. So is it normal just fo

Re: NaNs Just Don't Get No Respect

2012-08-17 Thread F i L
Your example: float f; if (condition1) f = 7; ... code ... if (condition2) ++f; is flawed in that condition1 is _required_ to pass in sync with condition2, or you'll get a NaN in the result. In this scenario, you're forced to provide a usable default explicitly

Re: NaNs Just Don't Get No Respect

2012-08-17 Thread F i L
bearophile wrote: On a more general note, I know many professionals in other fields that never write small articles about what they are doing. So is it normal just for programmers to write (small) articles like this? I write them, and other programmers I know write similar things. Maybe to pro

Re: NaNs Just Don't Get No Respect

2012-08-17 Thread bearophile
F i L: Why would it matter what is "normal"? It matters to me because I am curious. Why aren't my friends that work or study chemistry writing free small online articles like my programmer&CS friends do? Maybe it's systematic differences in their brain brain? Or it's just more easy to talk

Re: NaNs Just Don't Get No Respect

2012-08-17 Thread Adam D. Ruppe
I remember you (Walter) or somebody else talking about signaling NaNs before, but I don't remember many details about it. Does D use them? Is this an answer to the Reddit commenter who mentioned immediately throwing an exception?

Re: NaNs Just Don't Get No Respect

2012-08-17 Thread Jesse Phillips
On Saturday, 18 August 2012 at 01:07:43 UTC, F i L wrote: Your example: float f; if (condition1) f = 7; ... code ... if (condition2) ++f; is flawed in that condition1 is _required_ to pass in sync with condition2, or you'll get a NaN in the result. It is not f

Re: NaNs Just Don't Get No Respect

2012-08-17 Thread Walter Bright
On 8/17/2012 5:03 PM, Walter Bright wrote: Our discussion on this in the last few days inspired me to write a blog post about it: http://www.reddit.com/r/programming/comments/yehz4/nans_just_dont_get_no_respect/ http://www.drdobbs.com/cpp/nans-just-dont-get-no-respect/240005723 http://news.yc

Re: NaNs Just Don't Get No Respect

2012-08-17 Thread Walter Bright
On 8/17/2012 8:03 PM, bearophile wrote: Why aren't my friends that work or study chemistry writing free small online articles like my programmer&CS friends do? I have no idea. Please ask them and report back.