Squiggle logoSquiggle
API

Number

Squiggle numbers are Javascript floats.

Constants

Variable NameNumber NameValue
Number.minValueThe smallest positive numeric value representable in JavaScript5e-324
Number.maxValueThe largest positive numeric value representable in JavaScript1.7976931348623157e+308

Functions

Comparison

smaller

infix: <
Namespace optional
Signatures
Number.smaller(Number, Number) => Bool

larger

infix: >
Namespace optional
Signatures
Number.larger(Number, Number) => Bool

smallerEq

infix: <=
Namespace optional
Signatures
Number.smallerEq(Number, Number) => Bool

largerEq

infix: >=
Namespace optional
Signatures
Number.largerEq(Number, Number) => Bool

Algebra (Number)

add

infix: +
Namespace optional
Signatures
Number.add(Number, Number) => Number

subtract

infix: -
Namespace optional
Signatures
Number.subtract(Number, Number) => Number

multiply

infix: *
Namespace optional
Signatures
Number.multiply(Number, Number) => Number

divide

infix: /
Namespace optional
Signatures
Number.divide(Number, Number) => Number

pow

infix: ^
Namespace optional
Signatures
Number.pow(Number, Number) => Number

mod

modulo. This is the same as the '%' operator in Python. Note that there is no '%' operator in Squiggle for this operation.

Namespace optional
Signatures
Number.mod(Number, Number) => Number
Examples
mod(10, 3)
mod(-10, 3)
mod(10, -3)

Functions (Number)

unaryMinus

unary: -
Namespace optional
Signatures
Number.unaryMinus(Number) => Number
Examples
exp(3.5)

exp

exponent

Namespace optional
Signatures
Number.exp(Number) => Number
Examples
exp(3.5)

log

Namespace optional
Signatures
Number.log(Number) => Number
Examples
log(3.5)

log10

Namespace optional
Signatures
Number.log10(Number) => Number
Examples
log10(3.5)

log2

Namespace optional
Signatures
Number.log2(Number) => Number
Examples
log2(3.5)

floor

Namespace optional
Signatures
Number.floor(Number) => Number
Examples
floor(3.5)

ceil

Namespace optional
Signatures
Number.ceil(Number) => Number
Examples
ceil(3.5)

abs

absolute value

Namespace optional
Signatures
Number.abs(Number) => Number
Examples
abs(3.5)

round

Namespace optional
Signatures
Number.round(Number) => Number
Examples
round(3.5)

Algebra (List)

sum

Namespace optional
Signatures
Number.sum(List(Number)) => Number
Examples
sum([3,5,2])

product

Namespace optional
Signatures
Number.product(List(Number)) => Number
Examples
product([3,5,2])

cumprod

cumulative product

Namespace optional
Signatures
Number.cumprod(List(Number)) => List(Number)
Examples
cumprod([3,5,2,3,5])

diff

Namespace optional
Signatures
Number.diff(List(Number)) => List(Number)
Examples
diff([3,5,2,3,5])

Functions (List)

min

Namespace optional
Signatures
Number.min(List(Number)) => Number
Number.min(Number, Number) => Number
Examples
min([3,5,2])

max

Namespace optional
Signatures
Number.max(List(Number)) => Number
Number.max(Number, Number) => Number
Examples
max([3,5,2])

mean

Namespace optional
Signatures
Number.mean(List(Number)) => Number
Examples
mean([3,5,2])

quantile

Namespace optional
Signatures
Number.quantile(List(Number), Number) => Number
Examples
quantile([1,5,10,40,2,4], 0.3)

median

Namespace optional
Signatures
Number.median(List(Number)) => Number
Examples
median([1,5,10,40,2,4])

geomean

geometric mean

Namespace optional
Signatures
Number.geomean(List(Number)) => Number
Examples
geomean([3,5,2])

stdev

standard deviation

Namespace optional
Signatures
Number.stdev(List(Number)) => Number
Examples
stdev([3,5,2,3,5])

variance

Namespace optional
Signatures
Number.variance(List(Number)) => Number
Examples
variance([3,5,2,3,5])

sort

Namespace optional
Signatures
Number.sort(List(Number)) => List(Number)
Examples
sort([3,5,2,3,5])

Utils

rangeDomain

Signatures
Number.rangeDomain(Number, Number) => Domain
Examples
Number.rangeDomain(5, 10)

On this page