| Type | Description | Sample | ||||
|---|---|---|---|---|---|---|
| Integer | Integer value ranging from - 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 | 44 | ||||
| Binary, octal and hexadecimal values | Use 0b, 0o and 0h prefix to denote an integer in specific system. | 0b1001010 | ||||
| Floating point | Floating point value ranging from ±5.0 x 10 -324 to ±1.7 x 10 308 with 15 digits of precision. | 10.5 | ||||
| Fractions | ProCalc attempts to evaluate expressions using the common fractions instead of floating point numbers as long as it is possible. If the calculations involves using floating point values or if the fraction cannot be represented as a common fraction, ProCalc converts the value into floating point value. For example, if you try to evaluate 1 / 3, the result will be a common fraction. However, if you try to evaluate 1.0 / 3 (forcing the first operand to be a floating point value), the result will be a floating point value. The fractions are automatically reduced to the simplest form. You may enter a common fraction by dividing two integers. | 4/9 | ||||
| Complex numbers | A number followed by the "i" letter is considered to be a imaginary value. | 4i1 + 2i | ||||
| DMS values | A DMS value is a fraction represented as units (degrees), minutes (1/60 of a degree) and seconds (1/3600 of a degree). Internally a DMS value is stored as a common fraction (if possible). | 12:30:00 | ||||
| Boolean value | Two logical values: true and false. | true | ||||
| Matrices | Use the rectangular brackets [ and ] to define a matrix. Inside, use the comma symbol to separate items in row and the semicolon to denote end of row. For example, matrix:
|
[1, 2, 3; 4-2i, 5+3i, 1/3] | ||||
| Lists | A list contains one or more numeric values. Use curly brackets { and } to enter list and a comma to separate its items. | {1, 2, 3} | ||||
| Strings | Use the double-quotes to denote a string. If you want to include the double-quote inside the string, write it twice: "Alice has a ""funny"" cat" | "CATS. CATS ARE NICE" |
| Operator | Symbol | Samples |
|---|---|---|
| Addition | + | 2+2 = 4[1,2]+[2,5] = [3,7]1+2i + 3+4i = 4+8i |
| Subtraction | - | 10-8 = 2 |
| Multiplication | * | 2*2 = 4[1,2;3,4]*[5,6;7,8] = [19, 22; 43, 50](1+2i)*(3+4i) = 5+10i |
| Division | / | 11/2 = 5.5 |
| Integer division | \ | 11\2 = 5 |
| Modulo | % | 11%2 = 1 |
| Power | ^ | 2^10 = 1024 |
| Binary shift left | << | 1200<<5 = 38400 |
| Binary shift right | >> | 1200>>5 = 37 |
| Less than or equal | <= | 10<5 = false |
| More than or equal | >= | 10>=5 = true |
| Less than | < | 10<5 = false |
| More than | > | 10>5 = true |
| Equal | == | 10==5 = falseNote, that equal operator will always return false when a floating-point value is involved in comparison |
| Inequal | != | 10!=5 = trueNote, that inequal operator will always return true when a floating-point value is involved in comparison |
| And (logical and binary) | & | true & true = true0hab & 0hba = 0haa |
| Or (logical and binary) | | | true | false = true10 | 25 = 27 |
| Xor (logical and binary) | # | true # true = false10 # 25 = 19 |
| Unary negative value operator | - | -5 |
| Unary logical negation | ! | !true = false |
| Definition | Description | Example |
|---|---|---|
| sin(x) | Sine of x. X is in radians. | sin(1) = 0.841470984807897 |
| cos(x) | Cosine of x. X is in radians. | cos(1) = 0.54030230586814 |
| tan(x) | Tangent of x. X is in radians. | tan(1) = 1.5574077246549 |
| ctg(x) | Cotangent of x. X is in radians. | ctg(1) = 0.642092615934331 |
| arcsin(x) | The inverse sine of x. | arcsin(1) = 1.5707963267949 |
| arccos(x) | The inverse cosine of x. | arccos(1) = 0 |
| arctan(x) | The inverse tangent of x. | arctan(1) = 0.785398163397448 |
| arcctg(x) | The inverse cotangent of x. | arcctg(1) = 0.785398163397448 |
| abs(x) | Absolute value | abs(-5) = 5 |
| round(x) | Value rounded to the nearest integer. | round(2.6) = 3round(-2.6) = -3 |
| trunc(x) | Integer part of value | trunc(2.5) = 2trunc(-2.5) = -2 |
| frac(x) | Fraction part of value | frac(2.5) = 0.5frac(-2.5) = -0.5 |
| sqrt(x) | Square root of argument | sqrt(4) = 2 |
| sqr(x) | Argument, squared. | sqr(2) = 4 |
| ln(x) | Natural logarithm of argument | ln(1) = 0 |
| length(x) | Length of a string | length("CATS. CATS ARE NICE") = 19 |
| copy(x, start, len) | Substring of a string | copy("CATS. CATS ARE NICE", 0, 4) = "CATS" |
| pos(x, str) | Returns position of first occurrence of a substring in string or -1 if the string was not found. | pos("Alice has a cat", "a") = 7 |
| insert(str, x, pos) | Inserts a string into another string | insert("has ", "Alice a cat", 6) = "Alice has a cat" |
| delete(x, start, len) | Removes part of a string | delete("Alice has a cat", 0, 10) = "a cat" |
| uppercase(x) | Converts a string into upper case | uppercase("cats. cats are nice") = "CATS. CATS ARE NICE" |
| lowercase(x) | Converts a string into lower case | lowercase("CATS. CATS ARE NICE") = "cats. cats are nice" |
| strtoint(x) | Converts string into integer value | strtoint("5") = 5 |
| inttostr(x) | Converts integer value into string | inttostr(5) = "5" |
a = 5 b = [1,2;3,4] c = "Alice has a cat"
To define user function, use the same operator =. Function and function parameter naming rule is the same, as for the variables. Sample function definition follows:
f(x, y)=sqrt(x^2+y^2)
Function must have at least one parameter. Function parameter names hides variables with the same names. For example:
x=5 y=2 f(x)=x+y
In the example, y will be interpreted as a variable, but x - as a function parameter.
Return to the main manual page