com.codename1.util

## Class MathUtil

• ```public abstract class MathUtil
extends Object```
MathUtil for Java ME. This fills the gap in Java ME Math with a port of Sun's public FDLIBM C-library for IEEE-754.
`For the Freely Distributable C-library conforming to IEEE-754 floating point math.`, `For the GNU C variant of the same IEEE-754 routines.`, `Another take on the IEEE-754 routines.`, `Yet another take on the IEEE-754 routines.`, `For other approximations.`, `For fast but rough approximations.`, `For more fast but rough approximations.`
• ### Constructor Summary

Constructors
Constructor and Description
`MathUtil()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static double` `acos(double a)`
Return the arccosine of a.
`static double` `asin(double a)`
Return the arcsine of a.
`static double` `atan(double a)`
Return the arctangent of a, call it b, where a = tan(b).
`static double` ```atan2(double b, double a)```
For any real arguments x and y not both equal to zero, atan2(y, x) is the angle in radians between the positive x-axis of a plane and the point given by the coordinates (x, y) on it.
`static double` ```copysign(double x, double y)```
Deprecated.
`static double` ```copySign(double x, double y)```
`static double` `exp(double a)`
Return Math.E to the exponent a.
`static long` `floor(double a)`
Rounds the number down
`static int` `floor(float a)`
Rounds the number down
`static double` `log(double a)`
Return the natural logarithm, ln(a), as it relates to Math.E.
`static double` `log10(double a)`
Return the common base-10 logarithm, log10(a).
`static double` ```nextAfter(double start, double direction)```
Returns the next representable floating point number after the first argument in the direction of the second argument.
`static double` ```pow(double a, double b)```
Return a to the power of b, sometimes written as a ** b but not to be confused with the bitwise ^ operator.
`static long` `round(double a)`
Rounds the number to the closest integer
`static int` `round(float a)`
Rounds the number to the closest integer
`static double` ```scalb(double x, int n)```
scalbn (double x, int n) scalbn(x,n) returns x* 2**n computed by exponent manipulation rather than by actually performing an exponentiation or a multiplication.
`static double` ```scalbn(double x, int n)```
Deprecated.
`static double` `ulp(double d)`
Returns the size of an ulp (units in the last place) of the argument.
• ### Methods inherited from class java.lang.Object

`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### MathUtil

`public MathUtil()`
• ### Method Detail

• #### exp

`public static final double exp(double a)`
Return Math.E to the exponent a. This in turn uses ieee7854_exp(double).
• #### log

`public static final double log(double a)`
Return the natural logarithm, ln(a), as it relates to Math.E. This in turn uses ieee7854_log(double).
• #### log10

`public static final double log10(double a)`
Return the common base-10 logarithm, log10(a). This in turn uses ieee7854_log(double)/ieee7854_log(10.0).
• #### pow

```public static final double pow(double a,
double b)```
Return a to the power of b, sometimes written as a ** b but not to be confused with the bitwise ^ operator. This in turn uses ieee7854_log(double).
• #### asin

`public static final double asin(double a)`
Return the arcsine of a.
• #### acos

`public static final double acos(double a)`
Return the arccosine of a.
• #### atan

`public static final double atan(double a)`
Return the arctangent of a, call it b, where a = tan(b).
• #### atan2

```public static final double atan2(double b,
double a)```
For any real arguments x and y not both equal to zero, atan2(y, x) is the angle in radians between the positive x-axis of a plane and the point given by the coordinates (x, y) on it. The angle is positive for counter-clockwise angles (upper half-plane, y > 0), and negative for clockwise angles (lower half-plane, y < 0). This in turn uses ieee7854_arctan2(double).
• #### scalb

```public static final double scalb(double x,
int n)```
scalbn (double x, int n) scalbn(x,n) returns x* 2**n computed by exponent manipulation rather than by actually performing an exponentiation or a multiplication.
• #### scalbn

```public static final double scalbn(double x,
int n)```
Parameters:
`x` -
`n` -
Returns:
scalb(x,n)
• #### copySign

```public static final double copySign(double x,
double y)```
• #### copysign

```public static final double copysign(double x,
double y)```
Parameters:
`x` -
`y` -
Returns:
copySign(x,y)
• #### ulp

`public static double ulp(double d)`
Returns the size of an ulp (units in the last place) of the argument.
Parameters:
`d` - value whose ulp is to be returned
Returns:
size of an ulp for the argument
• #### nextAfter

```public static double nextAfter(double start,
double direction)```
Returns the next representable floating point number after the first argument in the direction of the second argument.
Parameters:
`start` - starting value
`direction` - value indicating which of the neighboring representable floating point number to return
Returns:
The floating-point number next to `start` in the direction of .
• #### round

`public static int round(float a)`
Rounds the number to the closest integer
Parameters:
`a` - the number
Returns:
the closest integer
• #### round

`public static long round(double a)`
Rounds the number to the closest integer
Parameters:
`a` - the number
Returns:
the closest integer
• #### floor

`public static int floor(float a)`
Rounds the number down
Parameters:
`a` - the number
Returns:
a rounded down number
• #### floor

`public static long floor(double a)`
Rounds the number down
Parameters:
`a` - the number
Returns:
a rounded down number