473,325 Members | 2,342 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

How to import floor, ceil, etc with MIDP?

I'm using Sun ONE Studio 4 update 1, Community Edition with Nokia
Developer's Suite integration. I'm developing a J2ME project with MIDP.

I wanted to use the java.math.floor() function, but whenver I tried to
import the java.math package, the compiler told me it couldn't be found. I
was finally able to import java.lang.math, but this has a bare minimum
mathematic functions. I'm still a newb, so can someone help me with this?

SpaceCowboy
Jul 17 '05 #1
5 6549
On Wed, 13 Aug 2003 21:03:20 GMT, "SpaceCowboy" <bl***@hotmail.com>
wrote or quoted :
java.math.floor()


Java is case sensitive. The package is called java.lang. The class is
called java.lang.Math. You don't have to import java.lang.* classes.

So you can just say Math.floor( x );
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Jul 17 '05 #2
On Thu, 14 Aug 2003 02:26:21 GMT, "SpaceCowboy" <bl***@hotmail.com>
wrote or quoted :
I found java.lang.math
There is no such thing. What you may have found was java.lang.Math

Java is case sensitive.

Unfortunately, it does not contain the floor function. I found out MIDP 1.0
doesn't support floating point, so it's a moot point. I wound up just
making a fixed point version of the function I was writing.

check out C:/j2sdk1.4.2/docs/api/java/lang/Math.html

It most definitively has a floor function.

static double floor( double )

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Jul 17 '05 #3
Roedy Green wrote:

check out C:/j2sdk1.4.2/docs/api/java/lang/Math.html

It most definitively has a floor function.

static double floor( double )


Roedy, I think you are confusing things. They are talking about MIDP.
MIDP indeed doesn't support floats.
And java.lang.Math for MIDP contains no floor function.

--
Josef Garvi

"Reversing desertification through drought tolerant trees"
http://www.eden-foundation.org/

new income - better environment - more food - less poverty

Jul 17 '05 #4
That would be awesome since all of my development right now is centered
around MIDP/J2ME.

SpaceCowboy

"Roedy Green" <ro***@mindprod.com> wrote in message
news:41********************************@4ax.com...
On Thu, 14 Aug 2003 08:16:02 +0200, Josef Garvi
<jo***@eden-foundation.org> wrote or quoted :
And java.lang.Math for MIDP contains no floor function.


Arrgh. Sorry about that. Too bad they did not use different class
names.

We may need a special newsgroup for MIDP and other mini-Javas since
that knowledge is specialised.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Jul 17 '05 #5
Roedy Green wrote:

Arrgh. Sorry about that. Too bad they did not use different class
names.
I think the reason is that the normal java.lang.Math contains all functions
from little brother MIDP + many more. (for sharing your code upwards)

We may need a special newsgroup for MIDP and other mini-Javas since
that knowledge is specialised.


Yes, that would be very useful!

--
Josef Garvi

"Reversing desertification through drought tolerant trees"
http://www.eden-foundation.org/

new income - better environment - more food - less poverty

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jens Christian Larsen | last post by:
I have downloaded and installed the MIDP and CLDC reference implementations from java.sun.com but I can't seem to get them to work properly on Windows. When I start one of the example MIDlets in...
0
by: Gianluca | last post by:
Hi, I have a Motorola V525 with MIDP 2.0 support. I'm tring to use MIDP 2.0 sockets without success. In the development environment(Sun ONE Studio 5), everything seems to work but when I...
1
by: Raaijmakers, Vincent (IndSys,GE Interlogix) | last post by:
Does anyone know what could be the problem if PNG generated by PIL don't work for (java) MIDP applications? All the images can be used by different type of graphical applications. The java MIDP...
6
by: RobG | last post by:
I am writing a script to move an absolutely positioned element on a page by a factor using style.top & style.left. The amount to move by is always some fraction, so I was tossing up between...
0
by: Gabest | last post by:
I was doing a rasterizer when noticed how slow ceil was. What I found was rather interesting, see my report for more detail: ...
1
by: Anoniem | last post by:
Hi, I'm trying to start a example which comes with the midp2.0 distribution. My relevant environment variables are set in a batch file like: ...
5
by: john.leidel | last post by:
In doing some work on a library I'm writing, I'm trying to use the `floor()` function to get the largest integral value of a variable. I'm compiling everything using the mpich mpicc built with gcc...
3
by: bvdp | last post by:
Is it possible to do this from a function: import a module and append the defs in that module to an existing module/namesapce. So, in my code I have something like: # main code import mods ...
7
by: mingke | last post by:
I've learned that we can round up and down a float number by using Ceil and floor function. But, is this function still able to work if I the number I want to round up (or down) is zero? I have...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.