Kuvittele laskin, jonka tarkkuus ei rajoitu alle 16 merkitsevään numeroon. Älä enää unelmoi, sillä tämä laskin suorittaa useimmat tieteelliset laskutoimitukset satojen merkitsevien numeroiden tarkkuudella. Tämä oli liian hyvää pidettäväksi omana tietonamme, joten nauti.
Syöttö:
Lähtö:
Vakiot▼
Nimetyt vakiot▼
Seuraavat nimetyt vakiot ovat käytettävissä:
| Nimi(t) | Arvioitu arvo | |
|---|---|---|
e |
2.718281828459045… | |
π |
pi |
3.141592653589793… |
τ |
tau |
6.283185307179586… |
Numeeriset vakiot▼
Numeerisella vakiolla voi olla kokonaislukuosa, murtolukuosa tai molemmat, ja sitä voi halutessaan seurata eksponenttiosa:
-
Kokonaislukuosa koostuu yhdestä tai useammasta desimaaliluvusta
-
Murtolukuosa koostuu kantaluvun pisteestä
.jota seuraa yksi tai useampi desimaaliluku -
Eksponenttiosa koostuu
Etaie, jota seuraa valinnaisesti+tai-, ja jota seuraa yksi tai useampi desimaaliluku
| Esimerkkejä | ||
|---|---|---|
1 |
.5 |
1.5 |
1e2 |
.5e2 |
1.5e2 |
1E2 |
.5E2 |
1.5E2 |
1e+2 |
.5e+2 |
1.5e+2 |
1E+2 |
.5E+2 |
1.5E+2 |
1e-2 |
.5e-2 |
1.5e-2 |
1E-2 |
.5E-2 |
1.5E-2 |
Operaattorit▼
Seuraavat operaattorit ovat käytettävissä lausekkeissa:
| Kategoria | Ensisijaisuus | Assosiatiivisuus | Operaattori | Kuvaus | Esimerkki |
|---|---|---|---|---|---|
| Ensisijainen | korkein | ei mitään | () |
Alilauseke | (1 + e) |
| Jälkiliite | Toiseksi suurin | vasemmalta oikealle | () |
Funktio | lcm(3, 4) |
! |
Kertomala | 4! |
|||
| Potenssi | Kolmanneksi suurin | oikealta vasemmalle | ^ |
Potenssiinkorotus | 2^6 |
| Etuliite | Neljänneksi suurin | oikealta vasemmalle | + |
Yksikköplus | +3 |
- |
Negaatio | -7 |
|||
√ |
Neliöjuuri | √2 |
|||
| Kertolasku | Viidenneksi suurin | vasemmalta oikealle | Implisiittinen kertolasku | 2pi |
|
* |
Explicit multiplication | 2 * pi |
|||
/ |
Division | pi / 2 |
|||
% |
Remainder | 12 % 5 |
|||
| Additive | lowest | left to right | + |
Addition | e + 1 |
- |
Subtraction | e - 1 |
When a named constant is immediately followed by a numeric constant or named function, implicit multiplication is not recognizable. For example, pi2 and esin4 are in error, whereas 2pi, pi 2, and e sin 4 are valid.
Functions▼
The following functions are available for use in expressions. Function names are case sensitive.
The operand of a unary function need not be parenthesized. For example, ln 2 and sin sqrt 2 are valid. When used in this manner, the function name behaves as a prefix operator. For example, sin 2π is parsed as (sin 2) × π and ln 2 ^ 4 is parsed as ln(24).
Rounding▼
| Function | Description |
|---|---|
ceil(x) |
returns the smallest integer not less than x |
floor(x) |
returns the largest integer not greater than x |
int(x) |
returns the integer portion of x |
round(x) |
returns the integer value nearest to x (ties are rounded away from zero) |
trunc(x) |
returns the integer portion of x |
Roots, Exponents, and Logarithms▼
| Function | Description |
|---|---|
cbrt(x) |
returns the cube root of x |
exp(x) |
returns ex |
exp2(x) |
returns 2x |
exp10(x) |
returns 10x |
ln(x) |
returns the natural logarithm of x |
log(x, b) |
returns the base b logarithm of x |
log2(x) |
returns the base 2 logarithm of x |
log10(x) |
returns the base 10 logarithm of x |
sqrt(x) |
returns the square root of x |
Trigonometry▼
| Function | Description |
|---|---|
acos(x) |
returns the arccosine of x |
acosh(x) |
returns the inverse hyperbolic cosine of x |
acot(x) |
returns the arccotangent of x |
acoth(x) |
returns the inverse hyperbolic cotangent of x |
acsc(x) |
returns the arccosecant of x |
acsch(x) |
returns the inverse hyperbolic cosecant of x |
asec(x) |
returns the arcsecant of x |
asech(x) |
returns the inverse hyperbolic secant of x |
asin(x) |
returns the arcsine of x |
asinh(x) |
returns the inverse hyperbolic sine of x |
atan(x) |
returns the arctangent of x |
atan2(y, x) |
returns the two-argument arctangent of y and x |
atanh(x) |
returns the inverse hyperbolic tangent of x |
cos(x) |
returns the cosine of x |
cosh(x) |
returns the hyperbolic cosine of x |
cot(x) |
returns the cotangent of x |
coth(x) |
returns the hyperbolic cotangent of x |
csc(x) |
returns the cosecant of x |
csch(x) |
returns the hyperbolic cosecant of x |
hypot(x, y) |
returns the hypotenuse of x and y |
sec(x) |
returns the secant of x |
sech(x) |
returns the hyperbolic secant of x |
sin(x) |
returns the sine of x |
sinc(x) |
returns the cardinal sine of x |
sinh(x) |
returns the hyperbolic sine of x |
tan(x) |
returns the tangent of x |
tanh(x) |
returns the hyperbolic tangent of x |
Miscellaneous▼
| Function | Description |
|---|---|
abs(x) |
returns the absolute value of x |
avg(x, y) |
returns the average of x and y |
combin(n, k) |
returns the number of ways to select k items out of n items (binomial coefficient) |
gcd(x, y) |
returns the greatest common divisor of x and y |
hgd(k, n, K, N) |
returns the probability of selecting k items out of n items, given that K items are selected from N items |
interp(x, x0, y0, x1, y1) |
returns the linearly-interpolated y value for x given the coordinates (x0, y0) and (x1, y1) |
lcm(x, y) |
returns the least common multiple of x and y |
max(x, y) |
returns the maximum of x and y |
min(x, y) |
returns the minimum of x and y |
nabs(x) |
returns the negated absolute value of x |
permut(n, k) |
returns the number of ways to arrange k items out of n items |
sign(x) |
returns −1, 0, or +1 according to the value of x |
Syntax▼
The following EBNF-like notation describes the expression syntax:
expression:
| additive-expression
;
additive-expression:
| multiplicative-expression
| additive-expression '+' multiplicative-expression
| additive-expression '-' multiplicative-expression
;
multiplicative-expression:
| prefix-expression
| multiplicative-expression prefix-expression
| multiplicative-expression '*' prefix-expression
| multiplicative-expression '/' prefix-expression
| multiplicative-expression '%' prefix-expression
;
prefix-expression:
| '+' prefix-expression
| '-' prefix-expression
| '√' prefix-expression
| unary-function prefix-expression
| power-expression
;
unary-function:
| 'ceil' | 'floor'
| 'int' | 'trunc'
| 'round'
| 'sqrt' | 'cbrt'
| 'exp' | 'exp2' | 'exp10'
| 'ln' | 'log' | 'log2' | 'log10'
| 'sin' | 'asin' | 'sinh' | 'asinh' | 'sinc'
| 'cos' | 'acos' | 'cosh' | 'acosh'
| 'tan' | 'tanh' | 'atan' | 'atanh'
| 'sec' | 'asec' | 'sech' | 'asech'
| 'csc' | 'acsc' | 'csch' | 'acsch'
| 'cot' | 'acot' | 'coth' | 'acoth'
| 'abs' | 'nabs' | 'sign'
;
power-expression:
| postfix-expression
| postfix-expression '^' prefix-expression
;
postfix-expression:
| function
| primary-expression
| postfix-expression '!'
;
function:
| function-name '(' argument-list ')'
;
function-name:
| 'floor' | 'ceil'
| 'int' | 'trunc'
| 'round'
| 'sqrt' | 'cbrt'
| 'exp' | 'exp2' | 'exp10'
| 'ln' | 'log' | 'log2' | 'log10'
| 'hypot'
| 'sin' | 'asin' | 'sinh' | 'asinh' | 'sinc'
| 'cos' | 'acos' | 'cosh' | 'acosh'
| 'tan' | 'tanh' | 'atan' | 'atanh' | 'atan2'
| 'sec' | 'asec' | 'sech' | 'asech'
| 'csc' | 'acsc' | 'csch' | 'acsch'
| 'cot' | 'acot' | 'coth' | 'acoth'
| 'abs' | 'nabs' | 'sign'
| 'min' | 'max' | 'avg'
| 'gcd' | 'lcm'
| 'combin' | 'permut' | 'hgd'
| 'interp'
;
argument-list:
| expression
| argument-list ',' expression
;
primary-expression:
| constant
| '(' expression ')'
;
constant:
| named-constant
| numeric-constant
;
named-constant:
| 'e'
| 'π' | 'pi'
| 'τ' | 'tau'
;
numeric-constant:
| integer-part [ fraction-part ] [ exponent-part ]
| fraction-part [ exponent-part ]
;
integer-part:
| digit { digit }
;
digit:
| '0' | '1' | '2' | '3' | '4'
| '5' | '6' | '7' | '8' | '9'
;
fraction-part:
| '.' integer-part
;
exponent-part:
| exponent-char [ exponent-sign ] integer-part
;
exponent-char:
| 'E'
| 'e'
;
exponent-sign:
| '+'
| '-'
;
