DoublesealedA 64-bit IEEE-754 floating-point number -- the type of literals like 3.14. Arithmetic with either an Integer or a Double operand happens in floating point and yields a Double. Whole values print without a decimal point (4.0.s is '4').
Infinity and NaN follow IEEE rules: 1.0 / 0.0 is Double.inf, 0.0 / 0.0 is Double.nan, and NaN compares unequal to everything, itself included.
0.1 + 0.2 "* -> 0.30000000000000004 1.0 / 0.0 "* -> inf
Quoin-side numeric conveniences; the arithmetic itself is native.
Doubles gain the .. range constructor.
The type's zero value (0.0); Iterate#sum: seeds an accumulation with it.
Positive infinity, the IEEE-754 value that 1.0 / 0.0 yields; negate it for negative infinity. Handy for tests and boundary math.
1.0 / 0.0 "* -> inf
The IEEE-754 not-a-number value, e.g. what 0.0 / 0.0 yields. NaN is unequal to everything, including itself.
Double.nan == Double.nan "* -> false
The floating-point remainder after truncating division (a % b); the result takes the dividend's sign.
7.5 % 2 "* -> 1.5
Multiplication (a * b); the result is always a Double.
1.5 * 2.0 "* -> 3
Addition (a + b); the result is always a Double, whether the operand is an Integer or a Double.
0.5 + 0.25 "* -> 0.75
Unary minus (-self). 0 - self promotes through Integer#-:, yielding a Double.
Subtraction (a - b); the result is always a Double.
3.5 - 0.5 "* -> 3
A NumberRange from self (inclusive) to e (exclusive), stepping by 1.0.
(0.5..3.0).list "* -> #(0.5 1.5 2.5)
Division (a / b); the result is always a Double. Follows IEEE-754: dividing by zero gives an infinity (or NaN for 0.0 / 0.0), never an error.
10.0 / 4.0 "* -> 2.5 1.0 / 0.0 "* -> inf
Whether the receiver is less than the argument (a < b), compared on the floating-point scale. The one native comparison -- >, <= and >= derive from it.
1.5 < 2 "* -> true
Numeric equality with any value. Doubles and Integers compare by numeric value; a non-number is simply unequal, never an error. NaN is unequal to everything, itself included.
5.0 == 5 "* -> true
Absolute value.
(-2.5).abs "* -> 2.5
The smallest whole number at or above the receiver, as an Integer (range-guarded like floor).
2.25.ceil "* -> 3
Identity — a Double answers itself, so double normalizes a value that may already be a Double.
The largest whole number at or below the receiver, as an Integer. Raises an ArithmeticError if the result falls outside the 64-bit Integer range (there is no auto-promotion to BigInteger).
2.75.floor "* -> 2
The larger of the receiver and the argument, returned as the winning operand itself -- a mixed Double/Integer comparison keeps the winner's own type. The compare happens on the floating-point scale.
1.5.max: 2 "* -> 2
The smaller of the receiver and the argument, returned as the winning operand itself -- a mixed Double/Integer comparison keeps the winner's own type. The compare happens on the floating-point scale.
1.5.min: 2 "* -> 1.5
The next number up: self + 1.0.
2.5.next "* -> 3.5
The receiver raised to the argument's power (Integer or Double exponent); a Double base always yields a Double.
2.0.pow: 2 "* -> 4
The nearest whole number as an Integer, rounding halves away from zero (range-guarded like floor).
2.5.round "* -> 3 (0 - 2.5).round "* -> -3
The shortest decimal String that reads back as the same Double; whole values print without a decimal point.
3.14.s "* -> 3.14 4.0.s "* -> 4
-1.0, 0.0, or 1.0 by the receiver's sign; NaN stays NaN, and both zeroes count as 0.0.
(0 - 1.5).sign "* -> -1 0.0.sign "* -> 0
The square root. Raises an ArithmeticError for a negative receiver.
2.25.sqrt "* -> 1.5
The whole part as an Integer, dropping the fraction toward zero (range-guarded like floor).
(0 - 7.5).truncate "* -> -7