PostScript Math Commands

# 5.7.1 PostScript Math Commands

[abs] [add] [atan] [ceiling] [cos] [div] [exp] [floor] [ln] [log] [mul] [neg] [round] [sin] [sqrt] [sub] [truncate]

### abs

value1 abs absolute value

This operator returns -value1 if value1 < 0 and value1 if value1 > 0

This operator returns the sum of the two arguments.

### atan

numerator denominator atan value

This operator returns the arctangent of the ration numerator/denominator.

### ceiling

value1 neg value2

This operator returns the smallest integer greater than value1

### cos

value1 cos value

This operator returns the cosine of value1, where value1 is an angle expressed in degrees.

### div

num1 num2 div num3

This operator returns the result of dividing num1 by num2. The result is always a real.

### exp

base exponent exp value

This operator returns the value of base raised to the exponent power.

### floor

value1 floor value2

This operator returns the greatest integer less than value1

### ln

value1 ln value

This operator returns the natural logarithm of value1.

### log

value1 log value

This operator returns the base 10 logarithm of value1.

### mul

value1 value2 mul product

This operator multiplies the first two operands on the stack and pushes the result back onto the stack. The result is an integer if both operands are integers and the product is not out of range. If the product is too big, or one of the operands is a real, the result will be a real.

### neg

value1 neg - value1

This operator returns -value1.

### round

value1 round value2

This operator returns the nearest integer to value1, or the nearest, largest integer in the case of a tie.

### sin

value1 sin value

This operator returns the sine of value1, where value1 is an angle expressed in degrees.

### sqrt

value1 sqrt value2

This operator returns the square root of value1.

### sub

num1 num2 sub num3

This operator returns the result of subtracting num2 from num1.

### truncate

value1 truncate value2

This operator returns value1 without its fractional part. Thus 4.3 becomes 4, -3.8 becomes -3.

David Maxwell, who is still writing this, would like to hear your comments and suggestions. And remember, parts of this manual are based on P.J. Weingartner's work: A First Guide to PostScript.