Generic Number Functions



+ &rest numbers [function]
returns the sum of numbers.


- num &rest more-numbers [function]
If more-numbers are given, they are subtracted from num. Otherwise, num is negated.


* &rest numbers [function]
returns the product of numbers.


/ num1 num2 &rest more-numbers [function]
num1 is divided by num2 and more-numbers. The result is an integer if all the arguments are integers, and an float if at least one of the arguments is a float.


abs number [function]
returns absolute number.


round number [function]
rounds to the nearest integer. (round 1.5)=2, (round -1.5)=2.


floor number [function]

rounds to the nearest smaller integer. (floor 1.5)=1, (floor -1.5)=-2.


ceiling number [function]

rounds to the nearest larger integer. (ceiling 1.5)=2, (ceiling -1.5)=-1.


truncate number [function]

rounds to the absolutely smaller and nearest integer. (truncate 1.5)=1, (truncate -1.5)=-1.


float number [function]

returns floating-point representation of number.


max &rest numbers [function]

finds the maximum value among numbers.


min &rest numbers [function]

finds the minimum number in numbers.


random range &optional (randstate *random-state*) [function]

Returns a random number between 0 or 0.0 and range. If range is an integer, the result is truncated to an integer. Otherwise, a floating value is returned. Optional randstate can be specified to get predictable random number sequence. There is no special data type for random-state, and it is represented with an integer vector of two elements.


incf variable &optional (increment 1) [macro]

variable is a generalized variable. The value of variable is incremented by increment, and it is set back to variable.


decf variable &optional decrement [macro]
variable is a generalized variable. The value of variable is decremented by decrement, and it is set back to variable.


reduce func seq [function]

combines all the elements in seq using the binary operator func. For an example, (reduce #'expt '(2 3 4)) = (expt (expt 2 3) 4)=4096.


rad2deg radian [function]

Radian value is converted to degree notation. #R does the same thing at read time. Note that the official representation of angle in EusLisp is radian and every EusLisp function that accepts angle argument requests it to be represented by radian.


deg2rad degree [function]
Conversion from degree to radian. Also accomplished by #D reader's dispatch macros.


k-okada 2013-05-21