AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
abs (Number num) yoix.math
 
Returns the absolute value of num. The result has the same type as the argument, except when num is the most negative integer, in which case the result is a double because there is no corresponding positive integer.
 
 Example:   The program,
import yoix.math.*;
import yoix.stdio.*;

int     m = MIN_INT + 1;    // MIN_INT is in yoix.math
int     n = MIN_INT;

printf("abs(m)=%O, abs(n)=%O\n", abs(m), abs(n));
prints
abs(m)=2147483647, abs(n)=2.147483648E9
on standard output. Notice that %O uses a different format for the two results, because the first number is an integer and the second is a double.
 
 Return:   Number
 
 See Also:   ceil, floor, iceil, ifloor, irint, iround, max, min, rint, round

 

Yoix is a registered trademark of AT&T Inc.