How to import floor, ceil, etc with MIDP?

Discussion in 'Java' started by SpaceCowboy, Aug 13, 2003.

  1. SpaceCowboy

    SpaceCowboy Guest

    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
     
    SpaceCowboy, Aug 13, 2003
    #1
    1. Advertisements

  2. SpaceCowboy

    pete kirkham Guest

    In J2SE floor is a static method of the java.lang.Math object. If it's
    not there in the J2ME version of the API, then it's nowhere.


    Pete
     
    pete kirkham, Aug 13, 2003
    #2
    1. Advertisements

  3. SpaceCowboy

    Roedy Green Guest

    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 );
     
    Roedy Green, Aug 14, 2003
    #3
  4. SpaceCowboy

    Roedy Green Guest

    There is no such thing. What you may have found was java.lang.Math

    Java is case sensitive.

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

    It most definitively has a floor function.

    static double floor( double )
     
    Roedy Green, Aug 14, 2003
    #4
  5. SpaceCowboy

    Josef Garvi Guest

    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
     
    Josef Garvi, Aug 14, 2003
    #5
  6. SpaceCowboy

    SpaceCowboy Guest

    That would be awesome since all of my development right now is centered
    around MIDP/J2ME.

    SpaceCowboy
     
    SpaceCowboy, Aug 14, 2003
    #6
  7. SpaceCowboy

    Josef Garvi Guest

    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)

    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
     
    Josef Garvi, Aug 15, 2003
    #7
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.