<div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Sun, Sep 30, 2018 at 11:17 AM Steve Barnes <<a href="mailto:gadgetsteve@live.co.uk">gadgetsteve@live.co.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Note that my statements above had a single = i.e. <br>
float(NaNAwareInt('nan')) produces float('nan'), etc., as does:<br>
<br>
In [42]: nan = decimal.Decimal('nan')<br>In [43]: decimal.Decimal(nan)<br>
Out[43]: Decimal('NaN')<br>In [44]: float(nan)<br>
Out[44]: nan<br></blockquote><div><br></div><div>I think this explanation is still a little confusing.  I take it what you're getting at is that a "NaN" of any particular type (float, Decimal, complex, NanAwareInt) should be a perfectly good initializer to create a NaN of a different type using its constructor.</div><div><br></div><div>I think that is sensible (not sure about complex).  Currently we have:</div><div><br></div></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div class="gmail_quote"><div><div><font face="monospace, monospace">>>> complex(nan)</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">(nan+0j)</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">>>> float(complex('nan'))</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">Traceback (most recent call last):</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">  File "<ipython-input-39-069ef735716e>", line 1, in <module></font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">    float(complex('nan'))</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">TypeError: can't convert complex to float</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace"><br></font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">>>> complex(float('nan'))</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">(nan+0j)</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">>>> float(complex('nan'))</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">Traceback (most recent call last):</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">  File "<ipython-input-41-069ef735716e>", line 1, in <module></font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">    float(complex('nan'))</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">TypeError: can't convert complex to float</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace"><br></font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">>>> from decimal import Decimal</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">>>> Decimal('nan')</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">Decimal('NaN')</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">>>> float(Decimal('nan'))</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">nan</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">>>> Decimal(float('nan'))</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">Decimal('NaN')</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">>>> complex(Decimal('nan'))</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">(nan+0j)</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">>>> Decimal(complex('nan'))</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">Traceback (most recent call last):</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">  File "<ipython-input-47-f48726d59102>", line 1, in <module></font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">    Decimal(complex('nan'))</font></div></div></div></div><div><div class="gmail_quote"><div><div><font face="monospace, monospace">TypeError: conversion from complex to Decimal is not supported</font></div></div></div></div></blockquote><div dir="ltr"><div class="gmail_quote"><div><br></div><div>I don't think we can change the "cast-from-complex" behavior... even though I think it maybe should have been different from the start.</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature">Keeping medicines from the bloodstreams of the sick; food <br>from the bellies of the hungry; books from the hands of the <br>uneducated; technology from the underdeveloped; and putting <br>advocates of freedom in prisons.  Intellectual property is<br>to the 21st century what the slave trade was to the 16th.<br></div></div></div>