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
1 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:
2 The API: public static double pow(double a, double b)
3 To use it:
4 Also: public static double sqrt (double a )
5 And many more, such as sin, cos, min, max!
6 double x, y, z ;
7 x = 1.5 ;
8 y = 2.0 ;
9 z = Math.pow ( x, y ) ;

in Table To:


© 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