×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    4

    Floating Point Numbers

    Hi all,

    Bit of a newbie, so bear with me. I've written a program in Python 3.0 which I'm trying to change to PyS60. To simplify my question, if I run the following code in Python 3.0:
    x=20
    print x/60
    it returns 0.333333
    If I run it in PyS60, it returns 0.
    Obviously, in Python 3.0, x is interperated as a floating point, whereas is PyS60 it's an integer.
    I could get around the problem using the float() function, or by changing the first line to x=20.0, but as I have several hundred lines of code to wade through I was hoping there might be an easier way. In other words, how do I force Python to recognise variable assignments as floating point.

    Cheers
    Last edited by 5 line screamer; 2009-03-13 at 09:50.

  2. #2
    Regular Contributor
    Join Date
    Sep 2005
    Location
    Finland, Helsinki
    Posts
    323

    Re: Floating Point Numbers

    Quote Originally Posted by 5 line screamer View Post
    - - how do I force Python to recognise variable assignments as floating point.
    Answered a few days ago:
    http://discussion.forum.nokia.com/fo...43&postcount=2

    Shortly:

    Code:
    from __future__ import division
    --
    Aapo Rista
    http://code.google.com/p/pys60gps/
    http://opennetmap.org/

  3. #3
    Registered User
    Join Date
    Feb 2009
    Posts
    4

    Re: Floating Potin Numbers

    Thanks for your help

Similar Threads

  1. Entering floating point numbers
    By rihoe in forum Symbian User Interface
    Replies: 0
    Last Post: 2008-08-26, 12:14
  2. java.lang.VerifyError when using floating point numbers?
    By camroe in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2005-01-28, 16:43
  3. Nokia 3650 & floating point numbers
    By hoyuka in forum Symbian
    Replies: 1
    Last Post: 2004-09-30, 19:23
  4. Floating point numbers / Angle between points
    By Pandaemonium in forum Mobile Java General
    Replies: 8
    Last Post: 2004-03-10, 16:02
  5. Floating point numbers
    By donalucc in forum Mobile Java General
    Replies: 2
    Last Post: 2003-02-17, 11:01

Posting Permissions

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