Raku Cases › Numerics

Numerics

Int, Rat, Num, Complex: arithmetic, rounding, overflow, and parsing numbers.

137 rules from 90 tests. 78 of those tests are confirmed on both engines: Raku++ and Rakudo 2026.11 both pass, or Raku++ gives Rakudo's answer on every probe of a family. The verdict is the test's, not each rule's. How to read a case.

6e-gatingRaku++ passesRakudo cannot run it2026-08-19 · 387d2c88
  1. 12

    From 6.e log and log10 of a negative Num give the complex logarithm; before 6.e they give NaN.

    (-1e0).log is 0+3.141592653589793i under 6.e

More from this test: Dates & times (2), Exceptions & control flow (1), Hashes & sets (3), I/O & processes (2), Lists & laziness (8), Classes, roles & the MOP (2), Operators (1), Everything else (2), Regexes & grammars (2), Scoping & phasers (2), Signatures & dispatch (1), Strings & Unicode (6), divergences (1).

approx-equal-toleranceRaku++ passesRakudo passes2026-09-16 · b22d82fc
  1. 1

    =~= compares with a relative tolerance, the difference over the larger magnitude, except when one side is exactly zero, where the comparison is absolute.

    1e-17 =~= 0 is True

  2. 2

    $*TOLERANCE holds the tolerance =~= uses; it can be read and a program may set it.

array-op-args-getc-get-and-friendsRaku++ passesRakudo passes2026-09-17 · 2e994990
  1. 4

    ** with an Int base and a huge Int exponent is computed exactly, so -1 raised to an odd bigint is -1.

    (-1) ** 4553535345364535345634543533 is not 1

More from this test: Compile-time errors (1), Hashes & sets (1), I/O & processes (1), Classes, roles & the MOP (1), Signatures & dispatch (2).

base-exact-and-exp-baseRaku++ passesRakudo passes2026-09-22 · 93b60d8b
  1. 1

    .base computes its digits exactly, however long the expansion or small the value.

    (2/3).base(10, 40) is sixes to the last digit; (1/10000000000).base(3) is not 0.000000

  2. 2

    .base with an explicit digit count pads an integer with zeros, rounds a carry into the integer part, and refuses a negative digit count.

    121.base(11, 3) ends .000; (98/99).base(10, 0) is 1

  3. 3

    .exp($base) is $base ** self, the inverse of .log($base).

    5.exp(2) is 32

base-repeating-integral-and-long-cyclesRaku++ passesRakudo passes2026-10-14 · e06890bc
  1. 1

    Rat.base-repeating answers a repeating cycle longer than 10,000 digits in full instead of truncating it with an empty cycle.

    (1/10007).base-repeating has a 10,006-digit cycle

  2. 2

    .base-repeating of an integral Rat has no trailing point.

    (4/1).base-repeating is ("4", "")

More from this test: divergences (1).

batch1-silent-wrong-answersRaku++ passesRakudo passes2026-08-27 · 0d989883
  1. 2

    .parse-base, .UInt and .base-repeating refuse bad input with an armed Failure (X::Str::Numeric, X::Syntax::Number::RadixOutOfRange, X::OutOfRange) that throws when used in arithmetic.

More from this test: I/O & processes (3), Lists & laziness (2), Everything else (2), Scoping & phasers (1).

batch11b-typed-blobsRaku++ passesRakudo passes2026-07-23 · 9baeff7c
  1. 3

    A radix literal takes a list of digit values in brackets. inferred

    :256[97, 98, 99, 128] is 0x61626380

  2. 6

    A value pushed to a uint32 native array wraps modulo 2**32. inferred

    pushing 0xFFFFFFFF + 5 to my uint32 @m stores 4

More from this test: Syntax & parsing (2), Types & coercion (2).

bitwise-huge-intsRaku++ passesRakudo passes2026-10-07 · 2c7d3dbd
  1. 2

    +&, +| and +^ on big Ints work on the infinite two's complement, for either sign of either operand and in either operand order.

blob-iteration-and-mutate-lvalueRaku++ passesRakudo passes2026-07-31 · 0619f097
  1. 3

    parse-base exists as a sub as well as a method, as in parse-base($str, 16).

More from this test: Containers & assignment (1).

cbor-and-nqp-buffer-opsRaku++ passesRakudo does not pass2026-07-24 · 21e46c1a
  1. 3

    Assigning a double to a num32 variable rounds it to single precision.

More from this test: Syntax & parsing (1), Types & coercion (2).

complex-words-order-and-allomorph-newRaku++ passesRakudo passes2026-10-23 · 72e0c5fb
  1. 1

    val and a word-list word take a digitless Complex only when it ends in Inf\i or is NaN\i; an imaginary NaN with a sign or a real part, a bare i and a spelling without \i stay Str.

    <0+NaNi> is a Str, not a Complex

    Also held by val-complex-inf-nan.

More from this test: Operators (1), Types & coercion (1).

conformance-phase3-containersRaku++ passesRakudo passes2026-07-25 · 4ab9323f
  1. 3

    Complex.reals returns a List.

More from this test: Lists & laziness (1), Stringification (1), Syntax & parsing (1).

cool-round-and-numeric-failuresRaku++ passesRakudo passes2026-07-26 · 444dfead
  1. 1

    .round($scale) is (self / $scale + 1/2).floor * $scale computed exactly whenever neither side is a Num, so an Int stays an Int and a Rat scale leaves no float drift.

    round(1000, 23.01) does not come out as 989.4300000000001

  2. 2

    Coercing a non-numeric string with .Int, .Num, .Numeric, .Rat, .FatRat or .Complex gives a Failure carrying X::Str::Numeric, as prefix + does.

  3. 3

    A string that spells a Complex number answers numeric routines as that Complex.

    abs "6+8i" is 10

corpus-batch-1Raku++ passesRakudo passes2026-07-22 · c9beb901
  1. 3

    Converting a Rat with big numerator or denominator to Num rounds exactly once, giving the correctly rounded double.

More from this test: Containers & assignment (1).

custom-real-bridgesRaku++ passesRakudo passes2026-09-22 · b6d664c2
  1. 1

    A class that does Real numifies through its own .Bridge in the sub forms such as log, cis, unpolar and is-approx, as it does in the method forms.

  2. 2

    The default .Bridge, delegating to .Num, comes with the Real role only: a Cool class with its own .Numeric has no .Bridge and numifies through .Numeric.

    a class whose .Numeric is Complex keeps its complex value

digest-native-widths-clusterRaku++ passesRakudo passes2026-08-03 · cc0f34e5
  1. 6

    Radix literals keep their exact value beyond the signed 64-bit range.

    0xFFFFFFFFFFFFFFFF is 18446744073709551615

  2. 7

    The radix conversion :16("…") is exact beyond the signed 64-bit range.

    :16("FFFFFFFFFFFFFFFF") is 18446744073709551615; :16("c.8") is 12.5

  3. 8

    A 64-bit blob element reads back unsigned.

    blob64.new(0xFFFFFFFFFFFFFFFF).list[0] is 18446744073709551615

  4. 9

    .polymod divides exactly when the invocant is larger than a native integer.

    0xFFFFFFFFFFFFFFFF.polymod(256 xx 7).reverse is eight 255s

    Also held by digest-bigint-and-native-cluster.

More from this test: Containers & assignment (2), Lists & laziness (2), Operators (2), Scoping & phasers (1).

divergence-result-typesRaku++ passesRakudo passes2026-07-25 · e05a8563
  1. 4

    A numeric string used in arithmetic enters the exact numeric tower (Int/Rat), not Num. inferred

    1 * "2" is an Int, 1 / "2" a Rat

  2. 7

    A list in numeric context is its element count. inferred

    (1, 2) + (3, 4, 5) is 5, an Int

  3. 9

    Numifying a non-numeric string with prefix + gives an undefined Failure that throws when used, while the empty string numifies to 0. inferred

    +"a" is a Failure; (+"") == 0

More from this test: Lists & laziness (3), Operators (2), Types & coercion (1).

divide-by-zero-failureRaku++ passesRakudo passes2026-07-28 · 4b8c8e24
  1. 1

    Dividing by zero yields a Failure carrying X::Numeric::DivideByZero, whose message names the operator actually used.

More from this test: Exceptions & control flow (1), divergences (1).

divmod-zero-6eRaku++ passesRakudo does not pass2026-08-24 · 237cfdc9
  1. 1

    Under 6.d 1 div 0 is a Failure and 1 mod 0 throws X::Numeric::DivideByZero; under 6.e both are Failures.

    1 mod 0 throws under 6.d and soft-fails under 6.e

More from this test: divergences (1).

ecosweep-900-batchRaku++ passesRakudo passes2026-09-09 · 063a5a1a
  1. 5

    NaN.Int is a Failure, not an immediate throw.

More from this test: Containers & assignment (1), I/O & processes (1), Lists & laziness (4), Operators (2), Regexes & grammars (1), Signatures & dispatch (2), Stringification (1), Syntax & parsing (1).

enum-raku-and-divzeroRaku++ passesRakudo passes2026-08-15 · 09b409c9
  1. 2

    div, mod, % and %% by zero throw, so try catches the error.

    try { 3 div 0 } catches an exception

  2. 3

    / by zero is lazy: 1/0 is the Rat <1/0> and does not throw at once.

    1/0 is <1/0>

More from this test: Stringification (1).

exe-allomorph-literal-nativeRaku++ passesRakudo passes2026-11-19 · 81d08790
  1. 3

    A negative-zero Num literal keeps its sign, in -0e0, in val(<-0e0>) and in the real part of <-0-0i>.

    val(<-0e0>) is not +0

More from this test: Types & coercion (1).

exe-float-fast-pathsRaku++ passesRakudo cannot run it2026-10-22 · d7c6d9d5
  1. 1

    Prefix - on 0e0 answers -0, and prefix - on an object numifies it through its .Numeric.

    -$x with $x = 0e0 is -0

exe-num-lane-bailsRaku++ passesRakudo cannot run it2026-10-23 · e24f05f1
  1. 1

    A Num / with a zero divisor (0e0, -0e0 or an Int 0) answers a Failure, not Inf.

  2. 2

    A Num ** that underflows answers an X::Numeric::Underflow Failure.

expmod-modulus-must-be-positiveRaku++ passesRakudo passes2026-10-14 · d017123e
  1. 1

    expmod with a modulus of zero or less throws (an X::AdHoc) instead of answering.

    expmod(3, 5, 0), expmod(3, 5, -7) and expmod(-3, 5, -7) die

More from this test: divergences (1).

fatrat-str-and-new-argumentsRaku++ passesRakudo passes2026-10-17 · 38e236da · #173
  1. 2

    Rat.new and FatRat.new bind Int:D \nu, Int:D \de, so a Rat, Num or Str argument dies instead of being truncated to an integer.

    FatRat.new(…, 18890217959702350060800.0) dies

More from this test: Stringification (1).

fractional-rangeRaku++ passesRakudo passes2026-08-21 · 874a2002
  1. 1

    A Range with a fractional endpoint keeps that endpoint for membership tests.

    2.4 ~~ 0..^2.5 is True

More from this test: Stringification (1).

gcd-lcm-at-int64-minRaku++ passesRakudo passes2026-10-14 · a35d3284
  1. 1

    gcd and lcm are never negative, including when an operand is -2**63.

    -2**63 gcd 0, -2**63 gcd -2**63 and -2**63 lcm 1 are positive

grand-review-c1-interpRaku++ passesRakudo passes2026-09-06 · fa74f74f
  1. 12

    %% on a Num dividend does not truncate it to an integer.

    4.5e0 %% 2 is False

  2. 17

    Prefix + on an undefined scalar gives the Int 0, and prefix - gives 0.

    (+$u).^name is Int

  3. 19

    A negative count for +> shifts left.

    5 +> -1 is 10

  4. 20

    abs of -2**63 is the exact positive Int.

    abs(-9223372036854775808) is 9223372036854775808

  5. 22

    <=> with a NaN operand is Nil.

    NaN <=> 0 is Nil

  6. 23

    A Complex with a zero imaginary part numifies to its real part where a Real is wanted.

    sprintf("%d", 3+0i) is 3

  7. 24

    Converting a big Int to Num is correctly rounded.

    (2**200).Num == 2e0 ** 200 is True

More from this test: Containers & assignment (1), Exceptions & control flow (3), I/O & processes (1), Operators (4), Scoping & phasers (4), Signatures & dispatch (3), Stringification (1), Strings & Unicode (1).

grand-review-c2-methodsRaku++ passesRakudo passes2026-09-06 · fa74f74f
  1. 1

    Rounding a Num beyond 2**63 is exact: .floor, .ceiling, .round, .truncate and .UInt return the full Int.

    1e19.floor is 10000000000000000000

  2. 2

    .UInt on a negative Int is a Failure.

    (-(2**70)).UInt.defined is False

  3. 3

    .Numeric on a Complex is the Complex itself.

    (3+4i).Numeric is 3+4i

  4. 7

    .base with a radix outside 2..36 dies.

    255.base(37) and 255.base(1) die; 255.base(16) is FF

More from this test: Hashes & sets (1), I/O & processes (6), Lists & laziness (1), Everything else (1), Strings & Unicode (3).

grand-review-c3-procsRaku++ passesRakudo passes2026-09-06 · fa74f74f
  1. 6

    A Num beyond 2**63 converts to Int exactly.

    1e19.Int is 10000000000000000000; 1e300.Int.chars is 301

More from this test: I/O & processes (5).

int-kernel-modRaku++ passesRakudo passes2026-10-04 · f05192c6
  1. 2

    Over Ints mod and % compute the same floored modulo, but with a zero divisor mod throws where % answers a Failure.

int-over-int-small-ratRaku++ passesRakudo passes2026-10-21 · a508cc93
  1. 1

    Int / Int answers a reduced Rat with a positive denominator, and a Rat with a zero denominator for x / 0.

int-word-ops-hot-pathRaku++ passesRakudo passes2026-10-21 · a508cc93
  1. 1

    div floors and mod takes the divisor's sign, and a zero divisor fails or throws.

  2. 2

    Int operators whose result leaves the 64-bit range answer a big Int: -2**63 div -1, -2**63 gcd 0 and a power past int64.

  3. 3

    An Int raised to a negative Int power is a Rat.

More from this test: divergences (1).

iospec-parts-and-numeric-identityRaku++ passesRakudo passes2026-07-27 · 5ee18c68
  1. 5

    .Numeric and .Real on a value that is already numeric return it unchanged, so an Int or Rat is not turned into a Num.

More from this test: I/O & processes (4), Lists & laziness (1), Strings & Unicode (1), Types & coercion (1).

itemization-and-list-foldsRaku++ passesRakudo passes2026-07-26 · 0ccec43d
  1. 5

    .lsb, .msb and .base are exact on integers wider than 64 bits.

More from this test: Containers & assignment (1), Lists & laziness (3), Operators (2), Regexes & grammars (1), Stringification (1).

json-codec-number-typing-and-nfcRaku++ passesRakudo passes2026-10-12 · 7e42ac3e
  1. 1

    Rakudo::Internals::JSON (JSON::Fast) types a JSON number exactly as Str.Numeric does — type, value and normal form — including integers and decimals at the 18/19-digit seam and every exponent form.

More from this test: Strings & Unicode (1).

json-fast-clusterRaku++ passesRakudo does not pass2026-08-05 · ddc75ad1
  1. 8

    The parameterized role Rational[Int,Int] can be instantiated with .new.

    Rational[Int,Int].new(3,10) == 0.3 is True

More from this test: Containers & assignment (1), Operators (1), Signatures & dispatch (1), Strings & Unicode (1), Types & coercion (6).

kernel-closure-calleesRaku++ passesRakudo passes2026-10-21 · cce315ef
  1. 2

    1 +< $n with $n equal to -2**63 answers 1.

    1 +< -2**63 is 1

More from this test: Scoping & phasers (1).

lizmat-nqp-opsRaku++ passesRakudo passes2026-09-13 · 3a8f2148
  1. 2

    nqp::div_i floors, nqp::mod_i truncates toward zero, and nqp::mod_I floors.

    nqp::mod_i(-7, 2) is -1

More from this test: Lists & laziness (1), Operators (1), Everything else (1), Types & coercion (1).

match-numifies-exact-nativeRaku++ passesRakudo passes2026-10-29 · 7f28cba0 · #189
  1. 1

    Arithmetic on a Match numifies the text it matched as a Str does, giving an Int, Rat or Num by the literal.

    +$0, 0 + $0 and $0 * 1 of 「42」 are the Int 42

match-numify-intRaku++ passesRakudo passes2026-07-22 · 080057c6
  1. 1

    Numifying a Match follows the string numification ladder: a capture of digits numifies to Int and a decimal to Rat, never a blanket Num.

    +$0 of a digit capture is Int; -"9.5" is Rat

method-argument-edgesRaku++ passesRakudo passes2026-11-09 · 6d62482c
  1. 1

    .log with an explicit base divides by the base's logarithm, so a base of 0 gives -0 (NaN for 0.log(0)) and a base of 1 is a division by zero.

    5.log(0) is -0, 0.log(0) is NaN, 5.log(1) is a division by zero

More from this test: Strings & Unicode (1), divergences (1).

method-call-shapes-and-core-tablesRaku++ passesRakudo passes2026-10-04 · 1ae46f02
  1. 12

    Nil.abs is the Int 0.

    Nil.abs is 0

More from this test: Containers & assignment (1), Classes, roles & the MOP (9), Operators (1), Strings & Unicode (1), Syntax & parsing (2).

minmax-real-rangeRaku++ passesRakudo passes2026-10-19 · 9550aecc
  1. 2

    .minmax of a lone Num or Rat is a Range of that value, not an Int Range.

    2.5.minmax is not 2..2

More from this test: Lists & laziness (1).

module-page-sextetRaku++ passesRakudo passes2026-07-30 · 8de6c3a0
  1. 9

    A radix digit list :256[…] yields a big Int when the value exceeds 64 bits.

More from this test: Classes, roles & the MOP (3), Regexes & grammars (7), Stringification (2), Strings & Unicode (1).

msb-lsb-builtinsRaku++ passesRakudo passes2026-09-16 · b22d82fc
  1. 1

    msb and lsb answer the position of an Int's highest and lowest set bit, counting from 0, and both answer Nil for zero.

  2. 2

    For a negative Int, msb answers the two's-complement position, which is the bit length of |n| - 1, in both the sub and the method form.

    msb(-1) is 0 and msb(-255) is 8

    Also held by numeric-coercions-and-refusals.

  3. 3

    lsb ignores the sign: a negative Int has the same lowest set bit as its magnitude.

msb-lsb-huge-intsRaku++ passesRakudo passes2026-09-28 · 010f5329
  1. 2

    msb of a negative Int is the two's-complement answer, the bit length of |n| - 1, and lsb ignores the sign.

    msb(-2**N) is N but msb(-2**N - 1) is N + 1

    Also held by msb-lsb-js-backend.

native-int-folded-literalRaku++ passesRakudo passes2026-11-08 · e82801e8
  1. 1

    A native int operator takes a literal expression folded at compile time (2**62, 1 +< 62, -2**62) as it takes a written literal, so the operation stays native and wraps.

    sub f(int $x) { $x * 2**62 }; f(3) is -4611686018427387904

  2. 2

    A native int combined with an Int held in a variable, or with a folded value wider than 64 bits, takes the Int candidate and grows.

nqp-div-mod-by-minus-oneRaku++ passesRakudo passes2026-11-10 · 3178a8ca
  1. 1

    nqp::div_i of the int64 minimum by -1 answers the int64 minimum and nqp::mod_i of it by -1 answers 0, on every machine.

nqp-json-fast-supportRaku++ passesRakudo passes2026-07-23 · 18eddc18
  1. 1

    .Numeric and .Real on a numeric string give the type the string spells (Int, Rat, Num), never a blanket Num.

More from this test: Signatures & dispatch (1).

nude-only-on-rationalsRaku++ passesRakudo passes2026-11-06 · b245ef4e
  1. 1

    .nude, .numerator and .denominator belong to a Rat or a FatRat only; on any other value they are X::Method::NotFound.

    5.denominator, 'x'.numerator and Any.nude die with X::Method::NotFound

  2. 2

    .nude on the Rat type object dies looking up its parts (X::AdHoc).

    Rat.nude dies

num-beside-rat-literalRaku++ passesRakudo passes2026-10-21 · a508cc93
  1. 1

    A decimal literal is a Rat, and a Num beside a Rat computes with the Rat's .Num and answers a Num, while an Int or a Rat beside a Rat still makes a Rat.

    $x * 1.0000001 + 0.000000001 over a Num $x equals the same arithmetic written with e0 literals

num-past-int64-integer-opsRaku++ passesRakudo passes2026-10-21 · cce315ef
  1. 1

    div, mod, gcd, lcm and the bitwise +&, +|, +^ take a Num operand of 2**63 or more as the Int it exactly is.

    1e20 div 7 is 14285714285714285714, 1e20 +& 255 is 0, 1e20 gcd 10 is 10

num-rat-continued-fractionRaku++ passesRakudo times out2026-10-22 · d7c6d9d5
  1. 1

    Num.Rat($epsilon) walks the continued fraction of the double and stops when the fractional part reaches 0 or the correctly rounded convergent is within epsilon, with convergents of any size.

    1e-300.Rat(0) is 1/10**300

  2. 2

    Num.Rat(0) is not the double's exact binary value.

    0.1e0.Rat(0) is 1/10

More from this test: divergences (1).

numeric-coercions-and-refusalsRaku++ passesRakudo does not pass2026-09-22 · 7500df9e
  1. 1

    The sub forms of the rounders pass a non-finite value through, as the method forms do.

    floor(NaN) is not 0 and floor(Inf) is not the int64 maximum

  2. 5

    .narrow on a Num tests for integrality approximately.

    ((.1e0 + .2e0) * 10).narrow is an Int

  3. 7

    A string with a Unicode MINUS SIGN numifies like one with an ASCII hyphen, keeping the sign of zero.

    "−0".Num is -0e0

More from this test: Compile-time errors (1), Types & coercion (2).

pdf-family-2026-09Raku++ passesRakudo passes2026-09-14 · a3586267
  1. 18

    Match.Rat is exact: the matched text read as a Rat.

More from this test: Containers & assignment (8), Exceptions & control flow (1), I/O & processes (1), Lists & laziness (1), Modules (1), Classes, roles & the MOP (14), Operators (1), Regexes & grammars (3), Scoping & phasers (4), Signatures & dispatch (9), Syntax & parsing (11), Types & coercion (3).

polymod-answers-seqRaku++ passesRakudo passes2026-11-09 · add45aeb
  1. 1

    .polymod returns a Seq, for an Int, a big Int, a Real, an infinite divisor list and a Junction divisor alike.

    10.polymod(3, 2).raku is (1, 1, 1).Seq

polymod-divisor-rulesRaku++ passesRakudo passes2026-11-10 · 9454d20f
  1. 1

    .polymod refuses a zero divisor whatever the invocant, a big Int included, and however the divisors come, a lazy list included.

    (2**70).polymod(0) and 5.polymod(0 xx *) are refused

  2. 2

    .polymod on a big Int treats divisors as on a small Int: a divisor of 1 ends the list and a divisor past an int64 divides by its true value. inferred

polymod-junction-and-real-stepsRaku++ passesRakudo passes2026-11-09 · fd4495e3
  1. 1

    .polymod takes a Junction divisor whole instead of autothreading the call.

    1.polymod(2 & 3) is (all(1, 1) 0)

  2. 2

    .polymod on a non-Int Real stops at a divisor of 1, accepts an infinite divisor list, fails for a negative invocant, and names polymod in its divide-by-zero error.

    2.5.polymod(1, 2) is not (0.5 0 1)

  3. 3

    Only an infinite divisor list lets .polymod stop early once the quotient reaches 0; a finite lazy divisor list is used in full. inferred

prefix-minus-int64-minRaku++ passesRakudo passes2026-10-01 · e9ab76da
  1. 1

    Prefix - on the minimum 64-bit integer promotes to a big Int instead of wrapping.

    -(-9223372036854775808) is 9223372036854775808

prefix-minus-object-keeps-numeric-kindRaku++ passesRakudo passes2026-11-09 · 0c64680d
  1. 1

    -$obj negates what the object's Numeric method answers and keeps its numeric kind — a big Int, a Rat or a Complex — as +$obj returns each intact.

    a Numeric of 1/3 gives <-1/3> and one of 1+2i gives -1-2i

prefix-plus-boxes-nativeRaku++ passesRakudo passes2026-11-06 · a7d16c43
  1. 1

    +$n of a native is the boxed number, since prefix:<+> has no native candidate, while -$n stays native.

    f(+$n) takes a multi's Int candidate (Num for a native num) where f($n) takes its int

prefix-plus-failure-nativeRaku++ passesRakudo passes2026-10-29 · 43341539 · #189
  1. 1

    Prefix + of a string or a Match that is not a number is a Failure, and of a number it is that number.

    +"=42" is a Failure, and so is +$/ of 「=42」

radix-prefix-too-long-is-no-numberRaku++ passesRakudo passes2026-11-10 · ab615543
  1. 1

    A string whose :N<…> radix is larger than any int holds is no number: converting it gives a Failure, "Cannot convert radix of N (max 36)".

    +":4294967298<11>" is a Failure, "Cannot convert radix of 4294967298 (max 36)"

range-construction-and-membershipRaku++ passesRakudo passes2026-09-22 · 1c853075
  1. 3

    Numifying an endless range gives Inf.

    +(1..*) is Inf

  2. 5

    Range membership is exact for integers beyond the native limits and for unbounded ends.

    2**70 ~~ 1..* and (2**64-1) ~~ uint64.Range are True

More from this test: Lists & laziness (4), Operators (1), Types & coercion (1).

range-randRaku++ passesRakudo passes2026-08-21 · 874a2002
  1. 1

    .rand on a numeric Range returns a Num drawn uniformly from the range.

    ($min .. $max).rand lies between the endpoints

rat-num-rounds-ties-to-evenRaku++ passesRakudo passes2026-10-14 · b1a65e86
  1. 1

    A Rat or FatRat with parts wider than 2**53 converts to Num correctly rounded, once, ties to even, also when its value sits exactly halfway between two doubles or a hair past halfway.

rat-rounding-exactRaku++ passesRakudo passes2026-09-16 · b22d82fc
  1. 1

    The subs floor, ceiling and round compute exactly on a Rat or FatRat too wide for a double, agreeing with the method forms.

    floor(FatRat.new(10**55 - 1, 10**55)) is 0

roast-3log-batch2Raku++ passesRakudo passes2026-09-28 · bda6f720
  1. 3

    A C99 hexadecimal float literal is a Num.

    0x1.8p1 is a Num

More from this test: Exceptions & control flow (1), Modules (1), Classes, roles & the MOP (6), Everything else (1), Regexes & grammars (5), Scoping & phasers (1), Syntax & parsing (1).

roast-last-filesRaku++ passesRakudo passes2026-09-28 · 6e9ef4cc
  1. 1

    An Int power whose exponent fits in 32 bits is computed exactly, and one with a wider exponent answers an overflow Failure rather than throwing. inferred

    (2 ** 1_000_000) ~~ Int is True; 3 ** 2**32 is a Failure

  2. 2

    An Int raised to a negative power whose result is below the smallest double is X::Numeric::Underflow, while the same for a Rat base is a plain 0e0. inferred

  3. 3

    A Rat power whose exact answer is too large to stay a Rat is a Num with the digits exact division would give. inferred

    1.0000001 ** 1_000_000 is 1.1051709125497935e0

More from this test: Compile-time errors (1), Containers & assignment (2), Lists & laziness (2), Classes, roles & the MOP (1), Operators (1), Scoping & phasers (2).

round-to-scaleRaku++ passesRakudo passes2026-08-21 · 874a2002
  1. 1

    .round($scale) answers in the scale's type: an Int scale gives an Int, a Rat scale an exact Rat, and only a Num scale a Num.

    178.14159e0.round(0.1) is 178.1

scalars-nil-junction-complex-dateRaku++ passesRakudo passes2026-07-27 · ebbe10f3
  1. 5

    Num.new constructs a Num from its argument. inferred

  2. 6

    Complex sqrt, as method and as sub, is computed from the modulus, without losing a unit in the last place on the real part.

  3. 7

    .narrow on a Complex with zero imaginary part narrows all the way, so a whole-number real part becomes an Int.

More from this test: Concurrency (1), Containers & assignment (1), Dates & times (1), Classes, roles & the MOP (1), Operators (1), Everything else (1), Stringification (1), Syntax & parsing (1), Types & coercion (1).

seq-bigint-gist-capRaku++ passesRakudo passes2026-08-08 · 718e1af9
  1. 1

    The ... sequence operator computes deduced arithmetic and geometric integer terms exactly beyond 2^63.

    1, 2, 4 ... * keeps doubling past 2^63

More from this test: Stringification (1).

shift-count-does-not-fit-native-intRaku++ passesRakudo passes2026-09-22 · 93b60d8b
  1. 1

    A shift count that does not fit a native int makes +< and +> throw "Cannot unbox N bit wide bigint into native integer" with the exact bit width.

    1 +< (2**70) throws instead of hanging; Roast expects Cannot unbox 101 bit wide bigint into native integer

small-rat-spill-rounds-onceRaku++ passesRakudo passes2026-10-21 · 477bf8d0
  1. 1

    A Rat result whose denominator would pass 2**64 becomes a Num.

    Also held by int-over-int-small-rat.

  2. 2

    The Num a Rat result spills to is the double nearest the exact value, the same as the sum taken in FatRat and converted at the end.

    1/4611686018427387903 + 3/999999999999999989 is 3.216840434497101e-18

str-abs-numifies-exactlyRaku++ passesRakudo passes2026-09-16 · fb4a6d59
  1. 1

    .abs on a Str numifies it exactly, as .Numeric does, so an integer string gives an Int and not a Num.

    "5000000000000000000".abs is the Int 5000000000000000000, not 5e+18

succ-pred-exact-towerRaku++ passesRakudo passes2026-09-01 · f3ec99b0
  1. 1

    .succ and .pred on a number are self + 1 and self - 1 in the number's own type: a bigint stays exact, a Rat or Num keeps its fraction and a Complex its imaginary part.

    (10**30).succ is 10**30 + 1; 2.5.succ is 2.5 + 1

sum-and-junction-object-numericRaku++ passesRakudo passes2026-10-21 · a0fd6a69
  1. 1

    .sum and sum(…) take an object through its .Numeric.

    ($a, $b).sum is 19 for two objects with a method Numeric

  2. 2

    An operator autothreaded over a junction numifies each object eigenstate through its .Numeric.

    any($a, $b) == 9 is any(False, True)

  3. 3

    .sum adds with the core +, so a user multi infix:<+> takes no part in it.

sum-through-the-exact-towerRaku++ passesRakudo passes2026-07-27 · 8c65c04a
  1. 1

    .sum is exact: big integers do not saturate and Rats keep their exactness.

    (2**70, 1).sum is 1180591620717411303425

  2. 2

    .sum autothreads over a junction element.

    (1|2, 3).sum is any(4, 5)

top100-roots-2026-09-02Raku++ passesRakudo does not pass2026-09-02 · 7af75847
  1. 10

    A bare i is a word, not the imaginary unit: val("i") is a Str and "is".Numeric fails, while val("1i") is a Complex.

    val("i") ~~ Numeric is False

More from this test: Containers & assignment (1), Exceptions & control flow (2), Lists & laziness (1), Modules (1), Native types & NativeCall (3), Classes, roles & the MOP (4), Regexes & grammars (3), Scoping & phasers (1), Stringification (1), Strings & Unicode (2), Syntax & parsing (3), Types & coercion (6).

typed-subtree-native-and-rat-leavesRaku++ passesRakudo passes2026-10-11 · 6ac55398
  1. 2

    An operation on native ints wraps and stays native, a store into a sized native wraps to its width, and assigning a new Rat to a variable leaves another holder of the old Rat unchanged. inferred

unclear-reread-fixesRaku++ passesRakudo does not pass2026-11-14 · e2981dc5 · rakudo#1872
  1. 3

    .base with :no-trailing-zeroes drops a Rat's trailing zeroes (and the point when nothing is left), while an Int and a Num keep theirs. inferred

    <1/2>.base(10, 20, :no-trailing-zeroes) is 0.5

More from this test: Operators (1), Strings & Unicode (1).

unicode-num-sigma-fold-collateRaku++ passesRakudo passes2026-07-31 · e85866a4
  1. 1

    A string of non-ASCII decimal digits (Unicode Nd), such as Arabic-Indic or Devanagari numerals, converts to a number positionally.

    "٤٢".Int reads the two-digit number instead of throwing

More from this test: Regexes & grammars (1), Strings & Unicode (2).

uninit-warning-names-and-placeRaku++ passesRakudo cannot run it2026-10-02 · 925260b1
  1. 2

    An uninitialized value in numeric context ($u + 1, $u.Numeric, abs($u)) warns.

  2. 4

    A numeric type object is not a number: Int + 1 treats Int as an uninitialized value in numeric context. inferred

More from this test: Exceptions & control flow (1), Syntax & parsing (1).

user-operators-compiledRaku++ passesRakudo times out2026-10-21 · 65713c7f
  1. 3

    A built-in arithmetic operator numifies an object operand through its .Numeric (or .Bridge), in the infix, in [*], in Z* and in a compound assignment like $v += 1.

    $v * $w over a class with a .Numeric is the product of those numbers, not 0

    Also held by metaop-object-operands-user-infix.

More from this test: Operators (1).

value-identityRaku++ passesRakudo passes2026-07-28 · 7768b86c
  1. 6

    Rat.Range is -Inf..Inf.

More from this test: Hashes & sets (1), Operators (1), Types & coercion (3).

where-sees-earlier-params-ov-and-cursorRaku++ passesRakudo passes2026-08-20 · c40e93b5
  1. 4

    A Range in numeric comparison is its element count.

    4 > 1..3 asks 4 > 3; 2 > (1..4) is False

More from this test: Regexes & grammars (2), Signatures & dispatch (1).

zero-denominator-rat-orderingRaku++ passesRakudo passes2026-09-17 · 0aadbf85
  1. 1

    Two zero-denominator Rats are ordered by the sign of the numerator: <1/0> above <0/0> above <-1/0>.

    <1/0> <=> <-1/0> is not Same

  2. 3

    A zero-denominator Rat is not an error: <1/0> is a Rat with numerator 1 and denominator 0, and it numifies to Inf.

    <1/0> numifies to Inf

zero-denominator-rat-ordersRaku++ passesRakudo passes2026-09-15 · 148f566b
  1. 1

    A zero-denominator Rat is equality-compared as its Num, but ordered against other values by ordinary cross-multiplication.

    <0/0> <= 1 is True, while $z == $z is False for <0/0>

    Also held by zero-denominator-rat-ordering.