integers
short, int, long | C, C# |
int | OCaml, YAML |
Int | Perl6 |
Int, uInt, Int8, Int16... | Pliant |
integer | Maple |
INTEGER, INT, SMALLINT | SQL92 |
INTEGER, INTEGER_8, NATURAL_8... | Eiffel |
int8,uint8,int16,uint16,...64 | Matlab |
decimal
float, double | C, C# |
float | Maple, OCaml, YAML |
Float, Float32, Float64 | Pliant |
NUMERIC, DECIMAL, DOUBLE PRECISION | SQL92 |
Rat | Perl6 |
DOUBLE, REAL | Eiffel |
single, double | Matlab |
integers
1000 | Ada, Awk, B, BourneShell, C, C#, C++, E, Eiffel, Haskell, Java, JavaScript, Logo, Maple, merd, OCaml, Oz, Pascal, Perl, Perl6, Pike, Pliant, Prolog, Python, Rebol, Ruby, Scheme, Smalltalk, SQL92, Tcl |
1000, 1000. | Common Lisp, Emacs Lisp |
1000, 1000., 1000.0 | Awk, Matlab |
1000, '1000'D | Classic REXX |
integers in base 2, octal and hexadecimal
0b1, 07, 0xf | Oz, Perl, Pike, Ruby |
0b1, 0o7, 0xf | OCaml, Perl6 |
07, 0xf | Awk, C, C++, JavaScript, Python, Tcl |
0xf | C#, E |
07 | B |
0o7, 0xf | Haskell |
1b | Eiffel |
2#1#, 8#7#, 16#f# | Ada |
2#{1}, #{F} | Rebol |
#b1, #o7, #xf | Common Lisp, Emacs Lisp, Scheme |
#2r1, #8r7, #16rf | Common Lisp, Emacs Lisp |
1b, Fh | Pliant |
'1'B, 'F'X | Classic REXX |
B'1', X'F' | SQL92 |
integer thousand-seperator
1_000, 10_00, 100_0 | E, Eiffel, OCaml, Perl, Perl6, Ruby |
1'000, 10'00, 100'0 | Rebol |
1_000 | Ada, merd |
decimals
1000., 1E3 | Ada, C, C++, Classic REXX, E, Java, JavaScript, Logo, Maple, OCaml, Python, Scheme, SQL92, Tcl |
1000., 1E3, 1,0 | Rebol |
1000., 1.E3 | Eiffel, Oz |
1000.0, 1E3 | C#, Common Lisp, Emacs Lisp, Pike, Prolog, Ruby, Smalltalk |
1000.0, 1.0E3 | Haskell |
1000, 1000.0, 1E3 | Awk, merd, Perl, Perl6 |
+ / - / * / / | BourneShell, C, C#, C++, Classic REXX, Common Lisp, Eiffel, Emacs Lisp, Haskell, Java, Logo, Maple, Matlab, merd, MUMPS, Perl, Perl6, Pliant, Prolog, Python, Ruby, Scheme, Smalltalk, SQL92, Tcl |
+ +. / - -. / * *. / / /. | OCaml |
sum / difference / product / quotient | Logo |
add / sub / mul / idiv div | PostScript |
** | Ada, Classic REXX, E, Fortran, merd, OCaml, Perl, Perl6, PL/I, Prolog, Python, Rebol, Ruby |
^ | Awk, Dylan, Eiffel, Lua, Matlab, Pliant |
* | APL |
**, ^ | Maple |
**, ^ and ^^ | Haskell |
pow | C, C++, Java, JavaScript, PHP, Pike, Python, SML, Tcl |
Pow | C#, Oz |
power | Delphi-Kylix, Logo, Rebol |
exp | PostScript |
expt | Common Lisp, Emacs Lisp, Scheme |
raisedTo | Smalltalk |
- | Ada, Awk, B, BCPL, BourneShell, C, C#, C++, Classic REXX, Common Lisp, E, Eiffel, Emacs Lisp, Haskell, Java, JavaScript, Logo, Maple, Matlab, merd, MUMPS, Perl, Perl6, Pike, Pliant, Prolog, Python, Rebol, Ruby, Scheme, Smalltalk, Tcl |
- -. | OCaml |
~ | Oz, SML |
neg | PostScript |
negate | Rebol |
minus | Logo |
random number
rand | Maple, Matlab, Perl, Perl6, Ruby |
random | Logo, Prolog |
$RANDOM | MUMPS |
Random.int | OCaml |
r: RANDOM create r.make r.start r.item |
Eiffel |
seed the pseudo random generator
srand | Perl, Perl6, Ruby |
set_seed | Eiffel |
Random.init, Random.self_init | OCaml |
rand('state',...) | Matlab |
rerandom | Logo |
RandomTools[MersenneTwister][SetState] | Maple |
addition vs multiplication
mathematical | BourneShell, C, C#, C++, Classic REXX, Eiffel, Haskell, Java, Maple, Matlab, merd, Perl, Perl6, Python, Ruby, Tcl |
same priorities | MUMPS, Smalltalk |
exponentiation vs negation (is -3^2 equal to 9 or -9)
mathematical | Classic REXX, Eiffel, Haskell, Maple, Matlab, Perl, Perl6, Python, Ruby |
negation first | OCaml |
sqrt / exp / abs | Ada, C, C++, Common Lisp, E, Eiffel, Emacs Lisp, Haskell, Java, JavaScript, Lua, Maple, OCaml, Pascal, Perl, Perl6, PHP, Prolog, Python, Ruby, Scheme, Smalltalk, SML, Tcl |
sqrt realsqrt / exp / abs | Matlab |
sqrt / exp / | Awk, Logo |
Sqrt / Exp / Abs | C#, Oz |
sqrt / / abs | PostScript |
Sqrt / / ABS | Modula-3 |
/ exp / abs | Pliant |
sqrt / / | Pike |
square-root / exp / abs or absolute | Rebol |
Sqrt / Exp / ABS | Classic REXX |
basic
sin / cos / tan | Ada, C, C++, Common Lisp, E, Emacs Lisp, Haskell, Java, JavaScript, Lua, Maple, Matlab, OCaml, Pascal, Perl, Perl6, PHP, Pike, Pliant, Prolog, Python, Ruby, Scheme, Smalltalk, SML, Tcl |
Sin / Cos / Tan | C#, Classic REXX, Oz |
sin / cos / | Awk, PostScript |
sine / cosine / tangent | Eiffel, Rebol |
radsin / radcos / radtan | Logo |
inverse
asin / acos / atan | Ada, C, C++, Common Lisp, JavaScript, Matlab, OCaml, Perl, Perl6, Pike, Pliant, Prolog, Python, Ruby, Scheme |
Asin / Acos / Atan | C#, Oz |
ASin / ACos / ATan | Classic REXX |
arcsin / arccos / arctan | Maple |
arcSin / arcCos / arcTan | Smalltalk |
arcsine / arccosine / arctangent | Rebol |
arc_sine / arc_cosine / arc_tangent | Eiffel |
/ / atan | PostScript |
/ / radarctan | Logo |
base e
ln | Delphi-Kylix, Logo, Maple, Pascal, PostScript, Smalltalk, SML |
log | Awk, C, C++, Common Lisp, E, Eiffel, Emacs Lisp, Java, JavaScript, Lua, Maple, Matlab, OCaml, Perl, Perl6, PHP, Pike, Pliant, Prolog, Python, Ruby, Scheme, Tcl |
Log | Ada, C#, Classic REXX, Oz |
log 10 | Haskell |
log-e | Rebol |
base 10
log10 | C, C++, Delphi-Kylix, Eiffel, Logo, Lua, Matlab, OCaml, Perl, Perl6, PHP, Pliant, Prolog, Python, Ruby, Tcl |
Log10 | C#, Classic REXX |
log | PostScript, SML |
log: 10 | Smalltalk |
log-10 | Rebol |
log[10] | Maple |
logBase 10 | Haskell |
Log(X => val, Base => 10.0) | Ada |
(log x 10) | Common Lisp |
base 2
log2 | Matlab |
log-10 / log-2 | Rebol |
Log(X => val, Base => 2.0) | Ada |
divmod | Python, Ruby |
divMod | Haskell |
div ldiv lldiv | C |
IntInf.quotrem | SML |
floor | Common Lisp, Dylan |
modulo of -3 / 2 is 1
% | Classic REXX, Perl, Perl6, Pike, Python, Ruby, Tcl |
%% | E |
\\ | Smalltalk |
mod | Ada, Common Lisp, Emacs Lisp, Haskell, Matlab, Prolog, SML |
MOD | Modula-3 |
modulo | Dylan, Logo, Ruby |
rem | Prolog |
modulo of -3 / 2 is -1
% | Awk, B, C, C#, C++, E, Java, JavaScript, PHP, Pliant |
# | MUMPS |
mod | Lua, OCaml, Oz, Pascal, PostScript, Prolog, XPath |
remainder | Logo, Ruby, Scheme |
rem | Ada, BCPL, Matlab, Smalltalk |
// | Classic REXX, Rebol |
\\ | Eiffel |
trunc / round / floor / ceil | C, C++, Maple, Matlab |
truncate / round / floor / ceiling | Common Lisp, Perl6, PostScript, Prolog, Scheme |
int / round / floor / ceil | JavaScript, Pike, Python |
int / round / / | Logo |
to_i, Integer() / round / floor / ceil | Ruby |
TRUNC / FORMAT / Floor / Ceil | Classic REXX |
/ round / floor / ceil | E, Java, Lua, PHP, SML, Tcl |
/ Round / Floor / Ceiling | C# |
/ Round / Floor / Ceil | Oz |
/ round / floor / ceiling | Dylan, Emacs Lisp, Haskell, PostScript, XPath |
/ ROUND / FLOOR / CEILING | Modula-3 |
/ rounded / floor / ceiling | Eiffel, Smalltalk |
int / / floor / ceil | Perl |
int_of_float / / floor / ceil | OCaml |
/ / floor / ceil | Lua |
/ Rounding / Floor / Ceiling | Ada |
to-integer / / / | Rebol |
and / or / xor
& / | / ^ | C, C#, C++, E, Eiffel, Java, JavaScript, Perl, Pike, Python, Ruby |
& / | | YCP |
+& / +| / +^ | Perl6 |
and / or / xor | PostScript, Rebol |
land / lor / lxor | OCaml |
logand / logior / logxor | Common Lisp |
bitand / bitor / bitxor | Logo, Matlab |
BITAND / BITOR / BITXOR | Classic REXX |
/\ / \/ / xor | Prolog |
negation
~ | C, C#, C++, Java, JavaScript, Perl, Pike, Python, Ruby, YCP |
not | Eiffel, PostScript |
lnot | OCaml |
lognot | Common Lisp |
bitnot | Eiffel, Logo |
complement | Rebol |
bitcmp | Matlab |
\ | Prolog |
left shift / right shift / unsigned right shift
<< / >> / >>> | Java, JavaScript |
<< / >> | C, C#, C++, Perl, Pike, Prolog, Python, Ruby, YCP |
|<< / |>> | Eiffel |
lsl / lsr or asr | OCaml |
bitshift | Matlab, PostScript |
ashift lshift | Logo |
(ash x positive-integer) / (ash x negative-integer) / | Common Lisp |