By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,441 Members | 996 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,441 IT Pros & Developers. It's quick & easy.

J2ME: Dealing with Floating Points?

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"gilgantic" <gi*******@yahoo.com> wrote in message
news:d6**************************@posting.google.c om...
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.
Jul 17 '05 #2

P: n/a
gilgantic wrote:
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/...&f=41&t=001663

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

RGDS

Thomas Winterberg

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.