PdfPostScriptCalculatorOperator Enum
Represents a PostScript operator that may appear in a PdfPostScriptCalculatorFunction.
Fields
abs | num1 abs num2 returns the absolute value of num1. The type of the result is the same as the type of num1 unless num1 is the smallest (most negative) integer, in which case the result is a real number. Examples 4.5 abs ⇒ 4.5 Errors: stackunderflow, typecheck See Also: neg |
add | num1 num2 add sum returns the sum of num1 and num2. If both operands are integers and the result is within integer range, the result is an integer; otherwise, the result is a real number. Examples 3 4 add ⇒ 7 Errors: stackunderflow, typecheck, undefinedresult |
and | bool1 bool2 and bool3 int1 int2 and int3 returns the logical conjunction of the operands if they are boolean. If the operands are integers, and returns the bitwise "and" of their binary representations. Examples true true and ⇒ true % A complete truth table Errors: stackunderflow, typecheck |
atan | num den atan angle returns the angle (in degrees between 0 and 360) whose tangent is num divided by den. Either num or den may be 0, but not both. The signs of num and den determine the quadrant in which the result will lie: a positive num yields a result in the positive y plane, while a positive den yields a result in the positive x plane. The result is a real number. Examples 0 1 atan ⇒ 0.0 Errors: stackunderflow, typecheck, undefinedresult |
bitshift | int1 shift bitshift int2 shifts the binary representation of int1 left by shift bits and returns the result. Bits shifted out are lost; bits shifted in are 0. If shift is negative, a right shift by –shift bits is performed. This operation produces an arithmetically correct result only for positive values of int1. Both int1 and shift must be integers. Examples 7 3 bitshift ⇒ 56 Errors: stackunderflow, typecheck |
ceiling | num1 ceiling num2 returns the least integer value greater than or equal to num1. The type of the result is the same as the type of the operand. Examples 3.2 ceiling ⇒ 4.0 Errors: stackunderflow, typecheck |
copy | any1 … anyn n copy any1 … anyn any1 … anyn pops n from the stack and duplicates the top n elements on the stack as shown above. Examples 5 4 3 2 copy ⇒ 5 4 3 4 3 Errors: rangecheck, stackoverflow, stackunderflow, typecheck See Also: dup |
cos | angle cos real returns the cosine of angle, which is interpreted as an angle in degrees. The result is a real number. Examples 0 cos ⇒ 1.0 Errors: stackunderflow, typecheck |
cvi | num cvi int (convert to integer) takes an integer or real number from the stack and produces an integer result. If the operand is an integer, cvi simply returns it. If the operand is a real number, it truncates any fractional part (that is, rounds it toward 0) and converts it to an integer. A rangecheck error occurs if a real number is too large to convert to an integer. (See the round, truncate, floor, and ceiling operators, which remove fractional parts without performing type conversion.) Examples –47.8 cvi ⇒ –47 Errors: rangecheck, stackunderflow, typecheck |
cvr | num cvr real (convert to real) takes an integer or real number and produces a real result. If the operand is an integer, cvr converts it to a real number. If the operand is a real number, cvr simply returns it. Errors: stackunderflow, typecheck See Also: cvi |
div | num1 num2 div quotient divides num1 by num2, producing a result that is always a real number even if both operands are integers. Use idiv instead if the operands are integers and an integer result is desired. Examples 3 2 div ⇒ 1.5 Errors: stackunderflow, typecheck, undefinedresult |
dup | any dup any any duplicates the top element on the operand stack. Errors: stackoverflow, stackunderflow |
eq | any1 any2 eq bool pops two objects from the operand stack and pushes true if they are equal, or false if not. The definition of equality depends on the types of the objects being compared. Simple objects are equal if their types and values are the same. This operator performs some type conversions. Integers and real numbers can be compared freely: an integer and a real number representing the same mathematical value are considered equal by eq. Examples 4.0 4 eq ⇒ true % A real number and an integer may be equal Errors: stackunderflow |
exch | any1 any2 exch any2 any1 exchanges the top two elements on the operand stack. Examples 1 2 exch ⇒ 2 1 Errors: stackunderflow |
exp | base exponent exp real raises base to the exponent power. The operands may be either integers or real numbers. If the exponent has a fractional part, the result is meaningful only if the base is nonnegative. The result is always a real number. Examples 9 0.5 exp ⇒ 3.0 Errors: stackunderflow, typecheck, undefinedresult |
Expression | Push the expression on the stack. Errors: stackoverflow |
false | – false false pushes a boolean object whose value is false on the operand stack. Errors: stackoverflow |
floor | num1 floor num2 returns the greatest integer value less than or equal to num1. The type of the result is the same as the type of the operand. Examples 3.2 floor ⇒ 3.0 Errors: stackunderflow, typecheck |
ge | num1 num2 ge bool pops two numbers from the operand stack and pushes true if the first number is greater than or equal to the second, or false otherwise. Examples 4.2 4 ge ⇒ true Errors: stackunderflow, typecheck |
gt | num1 num2 gt bool pops two numbers from the operand stack and pushes true if the first number is greater than the second, or false otherwise. Errors: stackunderflow, typecheck |
idiv | int1 int2 idiv quotient divides int1 by int2 and returns the integer part of the quotient, with any fractional part discarded. Both operands of idiv must be integers and the result is an integer. Examples 3 2 idiv ⇒ 1 Errors: stackunderflow, typecheck, undefinedresult |
if | bool {expr} if - removes both operands from the stack, then executes {expr} if bool is true. The if operator pushes no results of its own on the operand stack, but {expr} may do so. Examples 3 4 lt {3 4 add} if ⇒ 7 Errors: stackunderflow, typecheck See Also: ifelse |
ifelse | bool {expr1} {expr2} ifelse - removes all three operands from the stack, then executes {expr1} if bool is true or {expr2} if bool is false. The ifelse operator pushes no results of its own on the operand stack, but the expression it executes may do so. Examples 4 3 lt {4 3 add} {4 3 sub} ifelse ⇒ 1 % Since 4 is not less than 3 Errors: stackunderflow, typecheck See Also: if |
index | anyn … any0 n index anyn … any0 anyn removes the nonnegative integer n from the operand stack, counts down to the nth element from the top of the stack, and pushes a copy of that element on the stack. Examples 7 6 5 4 0 index ⇒ 7 6 5 4 4 Errors: rangecheck, stackunderflow, typecheck |
le | num1 num2 le bool pops two numbers from the operand stack and pushes true if the first number is less than or equal to the second, or false otherwise. Examples 4.2 4 ge ⇒ true Errors: stackunderflow, typecheck |
ln | num ln real returns the natural logarithm (base e) of num. The result is a real number. Examples 10 ln ⇒ 2.30259 Errors: rangecheck, stackunderflow, typecheck |
log | num log real returns the common logarithm (base 10) of num. The result is a real number. Examples 10 log ⇒ 1.0 Errors: rangecheck, stackunderflow, typecheck |
lt | num1 num2 lt bool pops two numbers from the operand stack and pushes true if the first number is less than the second, or false otherwise. Errors: stackunderflow, typecheck |
mod | int1 int2 mod remainder returns the remainder that results from dividing int1 by int2. The sign of the result is the same as the sign of the dividend int1. Both operands must be integers and the result is an integer. Examples 5 3 mod ⇒ 2 The last example above demonstrates that mod is a remainder operation rather than a true modulo operation. Errors: stackunderflow, typecheck, undefinedresult |
mul | num1 num2 mul product returns the product of num1 and num2. If both operands are integers and the result is within integer range, the result is an integer; otherwise, the result is a real number. Errors: stackunderflow, typecheck, undefinedresult |
ne | any1 any2 ne bool pops two objects from the operand stack and pushes false if they are equal, or true if not. What it means for objects to be equal is presented in the description of the eq operator. Errors: stackunderflow |
neg | num1 neg num2 returns the negative of num1. The type of the result is the same as the type of num1 unless num1 is the smallest (most negative) integer, in which case the result is a real number. Examples 4.5 neg ⇒ -4.5 Errors: stackunderflow, typecheck See Also: abs |
not | bool1 not bool2 int1 not int2 returns the logical negation of the operand if it is boolean. If the operand is an integer, not returns the bitwise complement (ones complement) of its binary representation. Examples true not ⇒ false % A complete truth table Errors: stackunderflow, typecheck |
Number | Push the number (System.Int32 or System.Double) constant on the stack. Errors: stackoverflow |
or | bool1 bool2 or bool3 int1 int2 or int3 returns the logical disjunction of the operands if they are boolean. If the operands are integers, or returns the bitwise "inclusive or" of their binary representations. Examples true true or ⇒ true % A complete truth table Errors: stackunderflow, typecheck |
pop | any pop - removes the top element from the operand stack and discards it. Examples 1 2 3 pop ⇒ 1 2 Errors: stackunderflow See Also: dup |
roll | anyn-1 … any0 n j roll any(j-1) mod n … any0 anyn-1 … anyj mod n performs a circular shift of the objects anyn-1 through any0 on the operand stack by the amount j. Positive j indicates upward motion on the stack, whereas negative j indicates downward motion. n must be a nonnegative integer and j must be an integer. roll first removes these operands from the stack; there must be at least n additional elements. It then performs a circular shift of these n elements by j positions. If j is positive, each shift consists of removing an element from the top of the stack and inserting it between element n - 1 and element n of the stack, moving all intervening elements one level higher on the stack. If j is negative, each shift consists of removing element n - 1 of the stack and pushing it on the top of the stack, moving all intervening elements one level lower on the stack. Examples 6 5 4 3 -1 roll ⇒ 5 4 6 Errors: rangecheck, stackunderflow, typecheck |
round | num1 round num2 returns the integer value nearest to num1. If num1 is equally close to its two nearest integers, round returns the greater of the two. The type of the result is the same as the type of the operand. Examples 3.2 round ⇒ 3.0 Errors: stackunderflow, typecheck |
sin | angle sin real returns the sine of angle, which is interpreted as an angle in degrees. The result is a real number. Errors: stackunderflow, typecheck |
sqrt | num sqrt real returns the square root of num, which must be a nonnegative number. The result is a real number. Errors: rangecheck, stackunderflow, typecheck See Also: exp |
sub | num1 num2 sub difference returns the result of subtracting num2 from num1. If both operands are integers and the result is within integer range, the result is an integer; otherwise, the result is a real number. Errors: stackunderflow, typecheck, undefinedresult |
true | – true true pushes a boolean object whose value is true on the operand stack. Errors: stackoverflow |
truncate | num1 truncate num2 truncates num1 toward 0 by removing its fractional part. The type of the result is the same as the type of the operand. Examples 3.2 truncate ⇒ 3.0 Errors: stackunderflow, typecheck |
Unknown | The PostScript Calculator operator is unknown and not supported. Errors: unregistered |
xor | bool1 bool2 xor bool3 int1 int2 xor int3 returns the logical "exclusive or" of the operands if they are boolean. If the operands are integers, xor returns the bitwise "exclusive or" of their binary representations. Examples true true xor ⇒ false % A complete truth table Errors: stackunderflow, typecheck |