03.08.2013 Views

PTOLEMY II - CiteSeerX

PTOLEMY II - CiteSeerX

PTOLEMY II - CiteSeerX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Expressions<br />

neighborhood type, type, double boolean return true if the first argument is in the neighborhood of<br />

the second, meaning that the distance is less than or equal<br />

to the third argument. The first two arguments can be any<br />

type for which such a distance is defined. For composite<br />

types, arrays, records, and matrices, then return true if the<br />

first two arguments have the same structure, and each corresponding<br />

element is in the neighborhood.<br />

pow double, double or<br />

complex, complex<br />

random no arguments or<br />

int or<br />

int, int<br />

TABLE 5: Basic mathematical functions<br />

function argument type(s) return type description<br />

double or<br />

complex<br />

double or<br />

{double} or<br />

[double]<br />

first argument to the power of the second<br />

one or more random numbers between 0.0 and 1.0 (see<br />

page 112)<br />

real complex double real part<br />

remainder double, double double remainder after division, according to the IEEE 754 floating-point<br />

standard (see page 113).<br />

round double long round to the nearest long, choosing the next greater integer<br />

when exactly in between, and throwing an exception if out<br />

of range. If the argument is NaN, the result is 0L. If the<br />

argument is out of range, the result is either MaxLong or<br />

MinLong, depending on the sign.<br />

roundToInt double int round to the nearest int, choosing the next greater integer<br />

when exactly in between, and throwing an exception if out<br />

of range. If the argument is NaN, the result is 0. If the argument<br />

is out of range, the result is either MaxInt or MinInt,<br />

depending on the sign.<br />

sgn double int -1 if the argument is negative, 1 otherwise<br />

sqrt double or<br />

double or<br />

square root. If the argument is double with value less than<br />

complex<br />

complex<br />

zero, then the result is NaN.<br />

complex case: sqrt( z)<br />

=<br />

z ⎛ ⎛∠z ------ ⎞ ∠z<br />

cos<br />

⎝ 2 ⎠<br />

+ isin⎛------⎞⎞<br />

⎝ ⎝ 2 ⎠⎠<br />

toDegrees double double convert radians to degrees<br />

toRadians double double convert degrees to radians<br />

120 Ptolemy <strong>II</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!