Python Front-end to GCC
Grant Edwards
invalid at invalid.invalid
Fri Oct 25 15:06:27 EDT 2013
On 2013-10-25, Mark Janssen <dreamingforward at gmail.com> wrote:
>>>>> OTOH why in particular would you want to initialise them with zeros? I
>>>>> often initialise arrays to nan which is useful for debugging.
>>>
>>> Is this some kind of joke? What has this list become?
>>
>> It's a useful debugging technique to initialize memory to distinctive
>> values that should never occur in real data.
>
> If you're doing this, you're doing something wrong.
Pardon me if I don't take your word for it.
> Please give me the hex value for NaN so I can initialize with my
> array.
Seriously? You haven't discovered google and wikepedia yet?
http://www.google.com/
http://en.wikipedia.org/
Assuming you're using IEEE-754, all 1's is a quiet NaN:
http://en.wikipedia.org/wiki/IEEE_floating_point
http://en.wikipedia.org/wiki/NaN
If you want a signaling NaN you've got to change one of the bits (see
the above links).
IIRC, the Pascal language required that using unintialized variables
caused an error. intializing FP values to a signalling NaN is a very
convenient way to do that.
--
Grant Edwards grant.b.edwards Yow! I'm also against
at BODY-SURFING!!
gmail.com
More information about the Python-list
mailing list