Python arithmetics

2 thoughts on “Python arithmetics

  1. Hello all,

    I have experimented with simple Python arithmetics. My intention is to do some temperature transducer normalisations, where the basic data comes from the
    AD converter of the GE865. It is in integer form, spanning from 0 to 2047 I suppose.

    As a result I would like to get a number with one decimal. Therefore I have icluded one desimal in the divider of the formula, run here on PythonWin with simple data taken from a live example, the value of the AD converter being 907:

    >>> print (907-600)/10.0

    If I let the divider also be an integer, it gives me:

    >>> print (907-600)/10

    All above is according to Python type mixing rules, I guess. But running the same examples on the GE865 work only if I use the latter expression:

        print (907-600)/10

    It prints 30 (as expected).

    Trying to run the other alternative on GE865:

        print (907-600)/10.0

    It only results in the following debug output, without printing anything:

    RuntimeError: Bad code object in .pyc file

    Is this a bug or have I missed something essential here?  Why these differing results between PythonWin and GE865 Python execution?

    Thanks for any help.


    1. I suppose is because of floating point type which is not supported in module Python.