×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    11

    NaN handling bug in 1.1.3

    (At europython, it was suggested that the forum is still the best place for bug reports...)

    >>> lat = 0.0
    >>> lon = 0.0
    >>> math.atan2(lat,lon)
    NaN
    >>> 360.0*math.atan2(lat,lon)
    ** interpreter crashes **

    number * NaN should be NaN (and is, in unix python.) While perhaps it could throw an exception (which wouldn't be right for IEEE math, but...) it shouldn't be making the interpreter die.

    (This is on the 6630 phone itself, I don't know what it does in the emulator, as I develop on a Mac...)

    I don't know if it's in 1.0 as well; computing bearings wasn't worthwhile before having Canvas :-)

  2. #2
    Super Contributor
    Join Date
    Dec 2004
    Posts
    643

    Re: NaN handling bug in 1.1.3

    Originally posted by eichin
    (At europython, it was suggested that the forum is still the best place for bug reports...)

    >>> lat = 0.0
    >>> lon = 0.0
    >>> math.atan2(lat,lon)
    NaN
    >>> 360.0*math.atan2(lat,lon)
    ** interpreter crashes **

    number * NaN should be NaN (and is, in unix python.) While perhaps it could throw an exception (which wouldn't be right for IEEE math, but...) it shouldn't be making the interpreter die.

    (This is on the 6630 phone itself, I don't know what it does in the emulator, as I develop on a Mac...)

    I don't know if it's in 1.0 as well; computing bearings wasn't worthwhile before having Canvas :-)
    The specific exception is KERN-EXEC 3:

    http://www.symbian.com/developer/tec...%2ekern%2dexec

    According to http://tinyurl.com/bvczc we need to install an exception handler to handle attempting arithmetic with NaN's:

    "Symbian OS also has special support for processor-level exceptions, such as division by zero. These are handled via the RThread class. Notice that if there is no exception handler in the thread and the thread raises an exception, the default implementation of the exception handler will panic with code KERN-EXEC 3."
    We'll see what we can do. Thanks for the report.

  3. #3
    Regular Contributor
    Join Date
    Sep 2003
    Location
    Finland
    Posts
    209

    Re: Re: NaN handling bug in 1.1.3

    Originally posted by jplauril

    According to http://tinyurl.com/bvczc we need to install an exception handler to handle attempting arithmetic with NaN's:
    Unfortunately this fix will not make it to the next release.

    Here is a workaround with "CSPyInterpreter" which you can use for the time being:

    1) Embed the interpreter in your native C++ application;
    2) Install an exception handler to your native application (in the thread where you create the "CSPyInterpreter" instance).

    Check these threads:

    http://discussion.forum.nokia.com/fo...threadid=55828
    http://discussion.forum.nokia.com/fo...threadid=58377

    Adding the exception handler, see this link:

    http://www3.symbian.com/faq.nsf/0/A1...B?OpenDocument

    So, these lines will be needed:

    Handler:

    Code:
    static void handler(TExcType /*aType*/)
    {
    // do nothing
    }
    and adding it:

    Code:
    RThread().SetExceptionHandler(handler,KExceptionFpe);
    Will result in 6600:

    Code:
    Python 2.2.2 (#0, Jun 28 2005, 14:26:52)
    [GCC 2.9-psion-98r2 (Symbian build 546)] on symbian_s60
    Type "copyright", "credits" or "license" for more information.
    Type "commands" to see the commands available in this simple line editor.
    >>> import math
    >>> lat = 0.0
    >>> lon = 0.0
    >>> math.atan2(lat,lon)
    NaN
    >>> 360.0*math.atan2(lat,lon)
    NaN
    >>>

  4. #4
    Super Contributor
    Join Date
    Dec 2004
    Posts
    643
    For reference: tracking number for this bug is #208.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×