Ticket #253 (new defect)

Opened 22 months ago

Last modified 3 weeks ago

Making a quiet nan results in an infinite loop on a bifferboard

Reported by: richi@… Owned by: xi
Priority: normal Component: pyyaml
Severity: normal Keywords: nan


I want to install ros (robot operating system) on a bifferboard running debian squeeze. I had the same problem also with lenny and ros electric. The bifferboard is a small device running a 486 compatible CPU at 140 MHz. I followed the tutorial on and the first few steps work, but rosinstall always freezes. I can have it running for a week, and it just uses the CPU and only a small amount of memory.

Executing the following results in an infinite loop:

#rosinstall --catkin ~/ros-underlay

When I terminate it with ctrl-c, I get the following call stack:

^CTraceback (most recent call last):
  File "/usr/local/bin/rosinstall", line 5, in <module>
    pkg_resources.run_script('rosinstall==0.6.17', 'rosinstall')
  File "/usr/lib/python2.6/dist-packages/", line 467, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.6/dist-packages/", line 1200, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.6/dist-packages/rosinstall-0.6.17-py2.6.egg/EGG-INFO/scripts/rosinstall", line 5, in <module>
    from rosinstall.rosinstall_cli import rosinstall_main
  File "/usr/local/lib/python2.6/dist-packages/rosinstall-0.6.17-py2.6.egg/rosinstall/", line 53, in <module>
    import yaml
  File "/usr/local/lib/python2.6/dist-packages/yaml/", line 8, in <module>
    from loader import *
  File "/usr/local/lib/python2.6/dist-packages/yaml/", line 8, in <module>
    from constructor import *
  File "/usr/local/lib/python2.6/dist-packages/yaml/", line 161, in <module>
    class SafeConstructor(BaseConstructor):
  File "/usr/local/lib/python2.6/dist-packages/yaml/", line 257, in SafeConstructor
    inf_value *= inf_value

The offending lines in /usr/local/lib/python2.6/dist-packages/yaml/ are as follows :

        inf_value = 1e300
    while inf_value != inf_value*inf_value:
        inf_value *= inf_value
    nan_value = -inf_value/inf_value   # Trying to make a quiet NaN (like C99).

Might be because the bifferboard doesn't have an FPU?

some more info that might be relevant:

# cat /proc/cpuinfo 
processor	: 0
vendor_id	: CyrixInstead
cpu family	: 4
model		: 1
model name	: Cx486SLC
stepping	: unknown
fdiv_bug	: yes
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: no
fpu_exception	: no
cpuid level	: -1
wp		: yes
flags		:
bogomips	: 49.15
clflush size	: 32
power management:

# python --version
Python 2.6.7

>>> inf_value = 1e300
>>> print inf_value
>>> print inf_value*inf_value
>>> print inf_value != inf_value*inf_value

>>> inf_value *= inf_value
>>> print inf_value
>>> print inf_value*inf_value
>>> print inf_value != inf_value*inf_value

# apt-cache show python-yaml | grep Version
Version: 3.09-5

I'm not a pythong expert, but the above results look strange to me. Executing it on my workstation, gives the results I would expect:

$ python --version
Python 2.7.3
$ python
>>> inf_value = 1e300
>>> print inf_value
>>> print inf_value*inf_value
>>> print inf_value != inf_value*inf_value
>>> inf_value *= inf_value
>>> print inf_value != inf_value*inf_value

Comparing the two, It looks like the bifferboard has no inf in addition to strangely handling nan. I don't know If python should handle that and how. But it might be good, if yaml prepared for such cpu's.

I applied a quick hack, as I don't think I'll use nan or inf on that device. I don't think that's a good solution, but it's better than an infinite loop.

    inf_value = 1e300
    loop_count = 10
    while inf_value != inf_value*inf_value and loop_count > 0:
        inf_value *= inf_value
        loop_count -= 1
    nan_value = -inf_value/inf_value   # Trying to make a quiet NaN (like C99).


Change History

comment:1 Changed 22 months ago by richi@…

Searching the web for further information, I came across . And here is what the bifferboard prints for these instructions:







repr(1e300 * 1e300)


repr(1e300 * 1e300 * 0)


repr(1e300 * 1e300 * -1)


comment:2 Changed 12 months ago by Spearryhiphop

the potency of the actual relatively - toms outlet much less the kisses regarding - toms for cheap online toms on the web these people abruptly cheap - toms for cheap shoes shocked along with flipped about as well as saw the actual grim face of wu ling

comment:3 Changed 11 months ago by sdfWR343Dykf Louis Vuitton Neverfull louis vuitton store in las vegas nv

comment:5 Changed 3 months ago by GeraldNut

quertontinto - Siterszz

comment:6 Changed 3 weeks ago by Thomaskr

Спасибо админу за интересный блог.


Add a comment

Modify Ticket

Change Properties
<Author field>
as new
as The resolution will be set. Next status will be 'closed'
to The owner will be changed from xi. Next status will be 'new'
The owner will be changed from xi to anonymous. Next status will be 'assigned'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.