Win a copy of Mastering Non-Functional Requirements this week in the Design forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to Float??  RSS feed

 
Roy Simon
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i know that the jvm for the cldc does not support floating point variables!! but is there any way by which i can use floating point numbers?? (for. eg i am creating an application that calculates the sales of a medical representative and i need floating point support)!! please suggest something!!
Regards
Simon
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are three ways.

1. Basically don't use decimals in your calculation, then using a String add the decimal point in the correct place. This works mostly with currency, but might work for you.

2. MathFP is a third part jar file that allows MIDP 1.0 to use Floats.

3. Use MIDP 2.0/CLDC 1.1 which now includes Floating points.

Mark
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!