rpCalc, being an RPN calculator, takes it's operations after the numbers that they operate on. In addition to the basic operations supported by all calculators, rpCalc implements mechanisms to increase power, flexibility, and convenience.
List of acceptable tokens:
- Any real number which fits into the space of a double-precision float (64 bits)
- NaN or NAN (Not a Number)
- Some constants:
- Eulers Number (e)
- Circle ratio (pi)
- The standard mathematical operators:
- + -- Addition
- - -- Subtraction
- * -- Multiplication
- / -- Division
- % -- Modulus (division remainder)
- ^ -- Exponentiation
- \ -- Reciprocate
- Stack manipulation function:
- d -- Duplicate
- r -- Discard
- x -- Exchange
- v -- Tri-Rotate (a,b,c)->(b,c,a)
- rl -- Roll-Left (move end of stack to front)
- rr -- Roll-Right (move front of stack to end)
- flip -- Flip the stack around
- count -- Push the size of the stack to the stack
- stack_copy -- Append a copy of the stack at the end of the stack
- stack_mirror -- Append a mirrored copy of the stack at the end of the stack
- Sorting, set comparison, min, and max:
- sort -- sort the entire stack in ascenting order
- rsort -- sort the entire stack in descending order
- sortn -- sort the last n elements in ascending order
- rsortn -- sort the last n elements in descending order
- shuffle -- shuffle the entire stack
- shufflen -- shuffle the last n elements
- setequal -- compare for equality two groups of n elements
- setnequal -- compare for inequality two groups of n elements
- min -- push a copy of the smallest element
- pmin -- push a copy of the smallest element in the top n elements
- max -- push a copy of the largets element
- pmax -- push a copy of the largest element in the top n elements
- Absolute Value (abs)
- Square root (sqrt), cube root (crt), or n'th root (root)
- Natural log (ln), common (base-10) log (lc), binary log (lb), or arbitrary log (log)
- Some special functions:
- gamma -- The Gamma Function
- lng -- The natural log of the gamma function
- erf -- The error function
- erfc -- The complementary error function
- Ellipse circumference:
- ecircr1 -- Ramanujan's first approximation of ellipse circumference
- ecircr2 -- Ramanujan's second approximation of ellipse circumference
- ecirc -- Compute ellipse circumference by calculating terms of an infinite sum
- Any trig, inverse trig, hyperbolic trig, or inverse hyperbolic trig function
- sin -- sine function
- cos -- cosine function
- tan -- tangent function
- sec -- secant function
- csc -- cosecant function
- cot -- cotangent function
- asin -- inverse sine function
- acos -- inverse cosine function
- atan -- inverse tangent function
- atan2 -- Like atan, but takes 2 parameters (y and x, vs y/x) and generates an angle from 0 to 2pi
- asec -- inverse secant function
- acsc -- inverse cosecant function
- acot -- inverse cotangent function
- sinh -- hyperbolic sine function
- cosh -- hyperbolic cosine function
- tanh -- hyperbolic tangent function
- sech -- hyperbolic secant function
- csch -- hyperbolic cosecant function
- coth -- hyperbolic cotangent function
- asinh -- inverse hyperbolic sine function
- acosh -- inverse hyperbolic cosine function
- atanh -- inverse hyperbolic tangent function
- asech -- inverse hyperbolic secant function
- acsch -- inverse hyperbolic cosecant function
- acoth -- inverse hyperbolic cotangent function
- Random numbers:
- rand_max -- Return the largest number rand can return
- rand -- Return a random integer between 0 and rand_max
- randf -- Return a random number in the range [0,1]
- randl -- Return a random integer with a lower bound
- randu -- Return a random integer with an upper bound
- randb -- Return a random integer bound inclusively by two numbers
- stackdump -- return the contents of the stack and end evaluation, rather then just the last element upon completion
- Evaluation: (The state modifier preserves input)
- = -- Equals
- > -- Greater then
- < -- Less then
- >= -- Greater then or equal to
- <= -- Less then or equal to
- ! -- Logical not
- isInf -- True if the number is either +Inf or -Inf, else false
- isNaN -- Checks if something is Not a Number
- Conditionals (?) -- Skip the next input token if the previous is not 0
- Grouping ({ and }) -- NOTE: These tokens are skipped in any case other then when when skipping in a conditional
- Loops:
- [ -- Begin fixed-iteration loop
- @[ -- Begin success-count loop
- ] -- End loop -- returns to the matching begin-loop symbol
- l -- The total number of completed iterations of the innermost loop
- @l -- The number of loops remaining in the innermost loop
- break -- break out of a loop unconditionally
- continue -- go back to the beginning of the loop, increment the loop counter
- Custom functions: (name:operations) or (name:vars:operations)
- ( -- Begin the definition for a function
- ) -- End the definition for a function
- : -- Separate the name, parameters, and operations fields in a function
- Rounding:
- round -- round to the nearest integer
- roundn -- round to the n'th decimal point
- floor -- round down
- ceil -- round up
- ans -- Return the answer to the last calculation -- NOTE: this is designed for automatons, and depends on the support of the mechanism (using this page will allow it work though)
- Bitwise operations -- NOTE: when used, all arguments are converted to integers
- and/& -- AND
- nand -- Not AND
- or/| -- OR
- nor -- Not OR
- not/~ -- NOT
- xor -- eXclusivly OR
- nxor -- Not eXclusivly OR (equivalent)
- imply -- implication
- >> -- Shift right
- << -- Shift left
- brr/<>> -- Rotate right
- brl/<<> -- Rotate left
- Data storage:
- store -- Store data in a data slot
- get -- Retrieve data from a data slot
- erase -- Remove the contents of a data slot
- Statistics:
- Stats stacks:
- spush -- Stats push - push a number to a stats stack
- spop -- Stats pop - pop an entry from a stats stack
- serase -- Stats erase - erase the contents of a stats stack
- sdump -- Dump the contents of a stats stack and end execution
- scount -- Push the size of a given stats stack to the main stack
- aad -- Average absolute deviation
- mean -- arithmetic mean
- median -- median of the data
- popstddev -- Standard Deviation of a population
- stddev -- Standard Deviation of a sample
- popskew -- skewness of a population
- skew -- skewness of a sample
- popkurt -- kurtosis of a population
- kurt -- kurtosis of a sample
- Probability:
- ncr -- Compute the binomial coefficient
- Some basic integer functions:
- lcm -- Lowest Common Multiple
- gcd -- Greatest Common Divisor
- Some functions from prime number theory:
- isPrime -- Determines if a given integer is prime
- isCoprime -- Determines if a pair of numbers share any factors
- factor -- Takes an integer and prints at least one factor, one of which will be -1 if it's a negative integer, followed by the number of factors found