numbers#
Variables#
add#
constadd: (left,right) =>Real=addReal
Defined in: layout/src/numbers.ts:44
left + right in the tower: exact when both are exact, otherwise a float.
left + right: exact when both are exact, otherwise a float.
Parameters#
left#
right#
Returns#
Functions#
coordinateText()#
coordinateText(
value,numberType,unit):string
Defined in: layout/src/numbers.ts:88
A coordinate label (section 5.2): the pretty text of a value on an axis of
numberType and unit, rounded as a label is, to three places. An exact
value is an int on an int axis where it is integral, else a fraction; a
float value, a sum involving a float, is a float whatever the axis. Without
a unit, the text has no pretty unit.
Parameters#
value#
numberType#
NumberType
unit#
TimeUnit | null
Returns#
string
coordinateValue()#
coordinateValue(
value,numberType):Real
Defined in: layout/src/numbers.ts:24
A bare value on an axis of number type numberType as Python’s numeric
tower holds it: a float value as a float, an int or fraction value
as an exact rational. The manifest is schema-valid, so the value has the
form its number type selects.
Parameters#
value#
JsonNumber | readonly [JsonNumber, JsonNumber]
numberType#
NumberType
Returns#
exactDistance()#
exactDistance(
left,right):Rational
Defined in: layout/src/numbers.ts:58
|left − right| exactly, a float read as its exact binary value.
Parameters#
left#
right#
Returns#
lengthValue()#
lengthValue(
timeline):Real|null
Defined in: layout/src/numbers.ts:34
A timeline’s length on its own axis, or null when the length is not known.
Parameters#
timeline#
{ }
Returns#
Real | null
midpoint()#
midpoint(
left,right):Real
Defined in: layout/src/numbers.ts:52
(left + right) / 2 in the tower: the sum, then an exact halving.
Parameters#
left#
right#
Returns#
negate()#
negate(
value):Real
Defined in: layout/src/numbers.ts:47
−value in the tower: exact for an exact value, a float’s negation for a float.
Parameters#
value#
Returns#
proportion()#
proportion(
t,length):number
Defined in: layout/src/numbers.ts:69
The proportion u = t / λ: an exact quotient rounded once to the nearest
double, a binary64 division when either is a float, 0 when λ is 0.
Parameters#
t#
length#
Returns#
number
times()#
times(
numerator,denominator,value):number
Defined in: layout/src/numbers.ts:100
A constant factor n/d formed before it multiplies (section 3.3): the
double nearest the exact product of n/d and the double value, so
1.2w is the double nearest 6/5 × w, never the binary64 product 1.2 * w.
Parameters#
numerator#
bigint
denominator#
bigint
value#
number
Returns#
number
zero()#
zero(
numberType):Real
Defined in: layout/src/numbers.ts:39
Zero in a number type: an exact 0, or the float 0.0.
Parameters#
numberType#
NumberType