Basic HTML version of Foils prepared Feb 19 1999

Foil 13 Additional Mathematical Operators

From Computing and Java Language Basics NPAC Java Academy February--April 99 -- Feb 13 1999. by Nancy McCracken

Java API of Math package
In Java, additional mathematical operators are given in a package called Math as methods. These methods typically use arguments and results of type double. To compute exponents:
The API: public static double pow(double a, double b)
To use it:
Also: public static double sqrt (double a )
And many more, such as sin, cos, min, max!
double x, y, z ;
x = 1.5 ;
y = 2.0 ;
z = Math.pow ( x, y ) ;



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Mon Jul 5 1999