Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32176 > unrolled thread
| Started by | mamboknave@gmail.com |
|---|---|
| First post | 2012-10-25 18:46 -0700 |
| Last post | 2012-10-27 13:33 -0500 |
| Articles | 6 on this page of 26 — 12 participants |
Back to article view | Back to comp.lang.python
a.index(float('nan')) fails mamboknave@gmail.com - 2012-10-25 18:46 -0700
Re: a.index(float('nan')) fails Terry Reedy <tjreedy@udel.edu> - 2012-10-25 22:04 -0400
Re: a.index(float('nan')) fails Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-26 02:44 +0000
Re: a.index(float('nan')) fails Terry Reedy <tjreedy@udel.edu> - 2012-10-26 03:54 -0400
Re: a.index(float('nan')) fails Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-26 15:26 +0000
Re: a.index(float('nan')) fails Terry Reedy <tjreedy@udel.edu> - 2012-10-26 14:49 -0400
Re: a.index(float('nan')) fails Nobody <nobody@nowhere.com> - 2012-10-27 17:40 +0100
Re: a.index(float('nan')) fails Cameron Simpson <cs@zip.com.au> - 2012-10-26 13:15 +1100
Re: a.index(float('nan')) fails mamboknave@gmail.com - 2012-10-25 19:22 -0700
Re: a.index(float('nan')) fails mamboknave@gmail.com - 2012-10-25 19:22 -0700
Re: a.index(float('nan')) fails MRAB <python@mrabarnett.plus.com> - 2012-10-26 03:19 +0100
Re: a.index(float('nan')) fails Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-26 02:33 +0000
Re: a.index(float('nan')) fails Ethan Furman <ethan@stoneleaf.us> - 2012-10-28 06:07 -0700
Re: a.index(float('nan')) fails Terry Reedy <tjreedy@udel.edu> - 2012-10-26 04:00 -0400
Re: a.index(float('nan')) fails Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-26 16:23 +0000
Re: a.index(float('nan')) fails MRAB <python@mrabarnett.plus.com> - 2012-10-26 17:43 +0100
Re: a.index(float('nan')) fails Chris Angelico <rosuav@gmail.com> - 2012-10-27 03:45 +1100
Re: a.index(float('nan')) fails Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-26 18:40 +0000
Re: a.index(float('nan')) fails Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-10-26 15:17 -0400
Re: a.index(float('nan')) fails Chris Angelico <rosuav@gmail.com> - 2012-10-27 12:29 +1100
Re: a.index(float('nan')) fails Terry Reedy <tjreedy@udel.edu> - 2012-10-26 14:58 -0400
Re: a.index(float('nan')) fails Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-10-27 00:48 -0400
Re: a.index(float('nan')) fails Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-10-27 08:56 +0200
Re: a.index(float('nan')) fails Nobody <nobody@nowhere.com> - 2012-10-27 17:45 +0100
Re: a.index(float('nan')) fails Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-10-27 13:07 -0400
Re: a.index(float('nan')) fails Mark Adam <dreamingforward@gmail.com> - 2012-10-27 13:33 -0500
Page 2 of 2 — ← Prev page 1 [2]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2012-10-26 14:58 -0400 |
| Message-ID | <mailman.2903.1351277929.27098.python-list@python.org> |
| In reply to | #32224 |
On 10/26/2012 12:23 PM, Steven D'Aprano wrote: > On Fri, 26 Oct 2012 04:00:03 -0400, Terry Reedy wrote: >> This inconsistency is an intentional decision to >> not propagate the insanity of nan != nan to Python collections. > > That's a value judgement about NANs which is not shared by everyone. > > Quite frankly, I consider it an ignorant opinion about NANs, despite what > Bertrand Meyer thinks. Reflectivity is an important property, but it is > not the only important property and it is not even the most important > property of numbers. Reflexivity is one of the definitional properties of the mathematical equality relationship and of equivalence relationships in general. It is not specific to numbers. It is assumed by the concept and definition of sets. -- Terry Jan Reedy
[toc] | [prev] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2012-10-27 00:48 -0400 |
| Message-ID | <mailman.2931.1351313336.27098.python-list@python.org> |
| In reply to | #32224 |
On 26 Oct 2012 16:23:51 GMT, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> declaimed the following in
gmane.comp.python.general:
> Anyone who has used a pocket calculator will be used to floating point
> calculations being wrong, so much so that most people don't even think
I don't know about the more modern calculators, but at least up
through my HP-41CX, HP calculators didn't do (binary) "floating
point"... They did a form of BCD with a fixed number of significant
/decimal/ digits (and did not keep a guard digit -- whereas my first
scientific calculator maintained one or two guard digits which were
beyond the displayable precision, but could be seen by subtracting the
displayed value from the computed value)
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
[toc] | [prev] | [next] | [standalone]
| From | Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> |
|---|---|
| Date | 2012-10-27 08:56 +0200 |
| Message-ID | <k6g0ig$kre$1@r03.glglgl.gl> |
| In reply to | #32266 |
Am 27.10.2012 06:48 schrieb Dennis Lee Bieber: > I don't know about the more modern calculators, but at least up > through my HP-41CX, HP calculators didn't do (binary) "floating > point"... They did a form of BCD with a fixed number of significant > /decimal/ digits Then, what about sqrt(x)**2 or arcsin(sin(x))? Did that always return the original x? Thomas
[toc] | [prev] | [next] | [standalone]
| From | Nobody <nobody@nowhere.com> |
|---|---|
| Date | 2012-10-27 17:45 +0100 |
| Message-ID | <pan.2012.10.27.16.45.50.438000@nowhere.com> |
| In reply to | #32268 |
On Sat, 27 Oct 2012 08:56:16 +0200, Thomas Rachel wrote: > Am 27.10.2012 06:48 schrieb Dennis Lee Bieber: > >> I don't know about the more modern calculators, but at least up >> through my HP-41CX, HP calculators didn't do (binary) "floating >> point"... They did a form of BCD with a fixed number of significant >> /decimal/ digits > > Then, what about sqrt(x)**2 or arcsin(sin(x))? Did that always return > the original x? I'd be impressed if it managed the latter, i.e. arcsin(sin(0))==0 while arcsin(sin(pi))==pi ;)
[toc] | [prev] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2012-10-27 13:07 -0400 |
| Message-ID | <mailman.2942.1351357638.27098.python-list@python.org> |
| In reply to | #32268 |
On Sat, 27 Oct 2012 08:56:16 +0200, Thomas Rachel
<nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de>
declaimed the following in gmane.comp.python.general:
> Am 27.10.2012 06:48 schrieb Dennis Lee Bieber:
>
> > I don't know about the more modern calculators, but at least up
> > through my HP-41CX, HP calculators didn't do (binary) "floating
> > point"... They did a form of BCD with a fixed number of significant
> > /decimal/ digits
>
> Then, what about sqrt(x)**2 or arcsin(sin(x))? Did that always return
> the original x?
>
The HPs probably not -- since they truncated at the decimal digit
level. The models with guard digits might have displayed the original,
as they used the guard digits to round results back up the display/entry
width (and to handle the infamous repeated addition of small amounts
<G>)
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
[toc] | [prev] | [next] | [standalone]
| From | Mark Adam <dreamingforward@gmail.com> |
|---|---|
| Date | 2012-10-27 13:33 -0500 |
| Message-ID | <mailman.2943.1351362840.27098.python-list@python.org> |
| In reply to | #32176 |
On Thu, Oct 25, 2012 at 9:04 PM, Terry Reedy <tjreedy@udel.edu> wrote:
> On 10/25/2012 9:46 PM, mamboknave@gmail.com wrote:
>>>>>
>>>>> a = [float('nan'), 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>>>> a
>>
>> [nan, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>>>>
>>>>> a.index(float('nan'))
>>
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> ValueError: list.index(x): x not in list
>>
>> That means, the function .index() cannot detect nan values.
>> It happens on both Python 2.6 and Python 3.1
>>
>> Is this a bug? Or I am not using .index() correctly?
>
>
> It is a consequence of the following, which some people (but not all)
> believe is mandated by the IEEE standard.
>
>>>> nan = float('nan')
>>>> nan is nan
> True
It should be noted, for the record, that "nan is nan" returning True
has nothing to do with the concept of numbers or the IEEE standard and
is purely a consequence that Python runs on hardware with memory
addresses and such.
>>>> nan == nan
> False
Here, equality, IS about number and this is appropriate and conforms
to the IEEE standard.
>>>> nanlist = [nan]
>>>> nan in nanlist
> True
>>>> nanlist.index(nan)
> 0
Here you just see an phenomenon with the python object/reference
model, which, being as it is, has nothing to do with numbers. This is
an area which, potentially could be changed in Python without
violating the IEEE standard whatsoever.
Mark
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.python
csiph-web