Number (package) - MrKaszeba19/PapajLang GitHub Wiki
Number is a package of functions for PapajScript. This package contains basic mathematical functions for numbers. It was released on August 22, 2022.
List of current Number functions
Notes:
- If you do not want to type
Number.
every time, just type@use(Number)
before. However, if you want to stop using the package, type@unuse(Number)
.
Package Function | Syntax | Output type | Purpose | Since |
---|---|---|---|---|
Number.sqr | NUM1 function | Number | Raise a number to the power of 2 | 0.5.3 |
Number.cub | NUM1 function | Number | Raise a number to the power of 3 | 0.5.3 |
Number.inv | NUM1 function | Number | Return 1/x | 0.5.3 |
Number.cbrt | NUM1 function | Number | cubic root | 0.5.3 |
Number.log | NUM1 NUM2 function | Number | Logarithm of N1 to base N2 | 0.5.3 |
Number.lbin | NUM1 function | Number | Binary logarithm of N1 | 0.5.3 |
Number.log2 | NUM1 function | Number | Binary logarithm of N1 | 0.5.3 |
Number.ldec | NUM1 function | Number | Decimal logarithm of N1 (to base 10) | 0.5.3 |
Number.log10 | NUM1 function | Number | Decimal logarithm of N1 (to base 10) | 0.5.3 |
Number.lhex | NUM1 function | Number | Hexadecimal logarithm of N1 (to base 16) | 0.5.3 |
Number.log16 | NUM1 function | Number | Hexadecimal logarithm of N1 (to base 16) | 0.5.3 |
Number.factorial | NUM1 function | Number | Factorial | 0.5.3 |
Number.sign | NUM1 function | Number | Sign function (-1 if N1 is negative, 1 if N is positive, 0 if N1 = 0) |
0.5.3 |
Number.sgn | NUM1 function | Number | Alias for Number.sign |
0.5.3 |
Number.round | NUM1 function | Number | round | 0.5.3 |
Number.floor | NUM1 function | Number | floor | 0.5.3 |
Number.ceiling | NUM1 function | Number | ceiling | 0.5.3 |
Number.roundTo | NUM1 NUM2 function | Number | round to specific decimal place (if N2 is negative, then it rounds to whole numbers respectively) | 0.5.3 |
Number.truncTo | NUM1 NUM2 function | Number | trunc to specific decimal place (if N2 is negative, then it rounds to whole numbers respectively) | 0.5.3 |
Number.floorTo | NUM1 NUM2 function | Number | floor to specific decimal place (if N2 is negative, then it rounds to whole numbers respectively) | 0.5.3 |
Number.ceilingTo | NUM1 NUM2 function | Number | ceiling to specific decimal place (if N2 is negative, then it rounds to whole numbers respectively) | 0.5.3 |
Number.isPrime | NUM1 function | Boolean | returns TRUE if a number is a prime, otherwise it returns FALSE |
0.5.3 |
Number.isEven | NUM1 function | Boolean | checks if a number is even | 0.5.3 |
Number.isOdd | NUM1 function | Boolean | checks if a number is odd | 0.5.3 |
Number.isInteger | NUM1 function | Boolean | checks if a number is integer | 0.5.3 |
Number.isNatural | NUM1 function | Boolean | checks if a number is natural (non-negative integer) | 0.5.3 |
Number.decToBase | NUM1 NUM2 function | String | convert the decimal number to the base-N2 number string (N2 values are [1..36]) | 0.5.3 |
Number.baseToDec | STR1 NUM1 function | Number | convert the base-N1 number string to the decimal number (N1 values are [1..36]) | 0.5.3 |
Number.decToBin | NUM1 function | String | convert the decimal number to the binary number string | 0.5.3 |
Number.binToDec | STR1 function | Number | convert the binary number to the decimal number string | 0.5.3 |
Number.decToOct | NUM1 function | String | convert the decimal number to the octal number string | 0.5.3 |
Number.octToDec | STR1 function | Number | convert the octal number to the decimal number string | 0.5.3 |
Number.decToHex | NUM1 function | String | convert the decimal number to the hexadecimal number string | 0.5.3 |
Number.hexToDec | STR1 function | Number | convert the hexadecimal number to the decimal number string | 0.5.3 |
Number.toUSNumber | NUM1 function | String | return the number string formatted with . as decimal separator and no thousand separator |
0.5.3 |
Number.toUSNumber2 | NUM1 function | String | return the number string formatted with . as decimal separator and (space char) as thousand separator |
0.5.3 |
Number.toUSNumber3 | NUM1 function | String | return the number string formatted with . as decimal separator and , as thousand separator |
0.5.3 |
Number.toEUNumber | NUM1 function | String | return the number string formatted with , as decimal separator and no thousand separator |
0.5.3 |
Number.toEUNumber2 | NUM1 function | String | return the number string formatted with , as decimal separator and (space char) as thousand separator |
0.5.3 |
Number.toEUNumber3 | NUM1 function | String | return the number string formatted with , as decimal separator and . as thousand separator |
0.5.3 |
Number.toEUNumber4 | NUM1 function | String | return the number string formatted with , as decimal separator and ' as thousand separator |
0.5.3 |
Number.toCommaNumber | NUM1 function | String | same as Number.toEUNumber |
0.5.3 |
Number.toDotNumber | NUM1 function | String | same as Number.toEUNumber |
0.5.3 |
Number.valueCommaNumber | STR1 function | Number | extract a number value from S1 string containing a number with comma as decimal separator | 0.5.3 |
Number.valueDotNumber | STR1 function | Number | extract a number value from S1 string containing a number with dot as decimal separator | 0.5.3 |
Number.valueEUNumber | STR1 function | Number | same as Number.valueCommaNumber |
0.5.3 |
Number.valueUSNumber | STR1 function | Number | same as Number.valueDotNumber |
0.5.3 |
List of obsolete functions
Package Function | Syntax | Output type | Purpose | Since | Latest version supported |
---|---|---|---|---|---|
Number.abs | NUM1 function | Number | Absolute value (moved to Vanilla) | 0.5.3 | 0.5.3.2 |