J2ME: Dealing with Floating Points?

G

gilgantic

How do you deal with floating points in J2ME? From my understanding
MIDP 1.0 does not allow you to use float or double primitives. I want
to be able to perform a calculations which give float or double
values.

Thanks
 
A

Anton Spaans

gilgantic said:
How do you deal with floating points in J2ME? From my understanding
MIDP 1.0 does not allow you to use float or double primitives. I want
to be able to perform a calculations which give float or double
values.

Thanks

Hi.

J2ME (CLDC1.0) does not have support for floats/doubles. Do a 'google' on
"fixed point J2ME" and you'll find some free libraries that implement fixed
point numbers. The ones i've found are mainly used for games, where
precision is of a lower priority than speed. I've written (using the
BigDecimal class from J2SE as a basis), for a program that i'm writing, a
library handling fixed point values with arbitray precision for J2ME. It is
very precise but not very fast.

-- Anton.
 
T

Thomas Winterberg

gilgantic said:
How do you deal with floating points in J2ME? From my understanding
MIDP 1.0 does not allow you to use float or double primitives. I want
to be able to perform a calculations which give float or double
values.

Thanks

Yes you are right you cannot use floating point primitives in J2ME. How
ever there is a working around to solve this problem. Try to look at
this url:

http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=41&t=001663

If it does't work please send me an e-mail and I will look at is.

RGDS

Thomas Winterberg
 
J

Java Web Services

How do you deal with floating points in J2ME? From my understanding
MIDP 1.0 does not allow you to use float or double primitives. I want
to be able to perform a calculations which give float or double
values.

Thanks

The J2ME Wireless Toolkit2.0(MIDP2.0) gives you floating point support.
 
A

Anton Spaans

Java Web Services said:
(e-mail address removed) (gilgantic) wrote in message

The J2ME Wireless Toolkit2.0(MIDP2.0) gives you floating point support.

Actually, it does not. CLDC1.1 (not MIDP2.0) gives you floating point
support (which is 'tied' to MIDP2.0 a lot).
-- Anton.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top