> I am trying to make a simple J2ME application that would do some
> manipulation with trigonometric functions on floating point data, on a
> handheld device. For prototyping purposes, I am using Sun
> Microsystems' WTK 2.2, and the settings have CDLC 1.1. My source file
> has the import:
> import java.lang.Math;
You never need to import java.lang classes.
> However, I get error messages as:
> Building "Test"
[quoted text clipped - 3 lines]
> for (int i = 1; i <= nu; i++)
> ^
How was 'nu' declared at this point?
> C:\WTK22\apps\Test\src\TestUtility.java:70: cannot resolve symbol
> symbol : method log (int)
[quoted text clipped - 9 lines]
> com.sun.kvem.ktools.ExecutionException
> Build failed

Signature
Lew
jestan - 28 Mar 2008 09:30 GMT
Hi cpptutor2000!
Math.log() is not available CLDC 1.1 , CLDC 1.1 supports floatingpoint
types, includes several more methods in java.lang.Math, but CLDC's
java.lang.Math is still a subset of the J2SE version of the
class.Please refer Java doc which came with the Wireless Tool Kit.
Have a look at static methods of Math class in CLDC 1.1
public final class Math extends java.lang.Object {
// Constants
public static final double E;
public static final double PI;
// Static methods
public static int abs(int a);
public static long abs(long a);
public static float abs(float a);
public static double abs(double a);
public static native double ceil(double a);
public static native double cos(double a);
public static native double floor(double a);
public static int max(int a, int b);
public static long max(long a, long b);
public static float max(float a, float b);
public static double max(double a, double b);
public static int min(int a, int b);
public static long min(long a, long b);
public static float min(float a, float b);
public static double min(double a, double b);
public static native double sin(double a);
public static native double sqrt(double a);
public static native double tan(double a);
public static double toDegrees(double angrad);
public static double toRadians(double angdeg);
}
I think, you have to use a third party library like MicroFloat (http://
www.dclausen.net/projects/microfloat/) to use J2SE (add, subtract,
multiply, divide, mod, comparisons, typecasts) as well as
java.lang.Math (sin, cos, exp, pow, log, etc.).
Jestan.
cpptutor2000@yahoo.com - 28 Mar 2008 14:47 GMT
Thank you very much for the URL to the microfloat package.
> Hi cpptutor2000!
>
[quoted text clipped - 42 lines]
>
> Jestan.