HELP! * GREY=local LOCAL HTML version of Foils prepared 15 January 1997

Foil 39 The Math and Number Objects in JavaScript

From JavaScript Tutorial for CPS616 Technologies of the Information Age 1997 Basic Information Track of CPS -- Spring Semester 97. by Geoffrey C. Fox * Important Information in IMAGE
Addon
Math has a set of properties(built in constants) including
E LN10 LN2 PI SQRT1_2 SQRT2 so that
Math.PI = 3.14159 etc.
Math methods include the usual ones in Fortran Intrinsic library with examples
Math.random() returns pseudo random number between 0 and 1
Math.abs(x) returns absolute value of x
Math.max(x1,x2) returns maximum of two numbers x1 and x2
Math.cos(x) returns cosine of argument x in radians
Math.round(x) rounds x to nearest positive or negative integer
The Number object has properties defining system dependent constants such as:
  • Number.MAX_VALUE is Largest representable number on your machine
  • Number.NaN represents "Not a Number" used by parseInt and parseFloat



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 Wed Feb 19 1997