You Are Here:

Community: Developer Discussion Boards

#1 Old Floating Point Numbers - 2009-03-13, 10:11

Join Date: Feb 2009
Posts: 4
5 line screamer
Offline
Registered User
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:
Quote:
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 10:50.
Reply With Quote

#2 Old Re: Floating Point Numbers - 2009-03-13, 11:47

Join Date: Sep 2005
Posts: 314
Location: Finland, Helsinki
aaaaapo
Offline
Regular Contributor
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/
Reply With Quote

#3 Old Re: Floating Potin Numbers - 2009-03-13, 12:08

Join Date: Feb 2009
Posts: 4
5 line screamer
Offline
Registered User
Thanks for your help
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Entering floating point numbers rihoe Symbian User Interface 0 2008-08-26 13:14
java.lang.VerifyError when using floating point numbers? camroe Mobile Java Tools & SDKs 2 2005-01-28 17:43
Nokia 3650 & floating point numbers hoyuka General Symbian C++ 1 2004-09-30 20:23
Floating point numbers / Angle between points Pandaemonium Mobile Java General 8 2004-03-10 17:02
Floating point numbers donalucc Mobile Java General 2 2003-02-17 12:01

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia