to Milli Points() - > int- Module
- std.
typeset - Receiver
- Length<Pt>
- Minimum arity
- 0
- Maximum arity
- 0
Declaration and parameters
LinkAvailability
Included by default: Pending
Import std.typeset in language mode 5.21.
The current compiler selects std/typeset.tpz for this language mode. Availability in other released editions and inclusion in each installed distribution are Pending.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
b48527d0a174· 1311 - compiler/crates/topaz_resolve/src/stdlib.rs at
b48527d0a174· 40 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
b48527d0a174· 1311 - compiler/crates/topaz_self_frontend/topaz/checker/builtin_signatures.tpz at
b48527d0a174· 522 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
b48527d0a174· 1296 - compiler/crates/topaz_self_frontend/topaz/checker/model.tpz at
b48527d0a174· 694 - compiler/crates/topaz_self_frontend/topaz/checker/model.tpz at
b48527d0a174· 697
Receiver
Length<Pt>
Parameter constraints
Physical Length values with the Pt, Mm, Cm, or In marker provide toScaledPoints returning int. One point is 65,536 scaled points. The result is the exact stored signed 64-bit count.
The scaledPoints member is absent from every Length type. Calling that removed member is rejected with TPZ5006. Length<Em> has no toScaledPoints member and must resolve to a physical length first.
fromScaledPoints accepts every int from -9223372036854775808 through 9223372036854775807 inclusive. It returns Length<Pt> with that exact scaled-point count. Zero and negative inputs are valid. Construction performs no rounding and has no value-dependent failure.
fromMilliPoints interprets its int argument as thousandths of a point. Its scaled-point result is roundEven of the exact rational input times 8192 divided by 125.
fromMilliPoints accepts -140737488355328000 through 140737488355327999 inclusive. An input outside that range stops with runtime diagnostic TPZ4004. It does not return Result, wrap, saturate, or clamp.
Length<Pt>.toMilliPoints returns roundEven of the exact stored count times 125 divided by 8192. Every representable point length has a representable int result.
roundEven selects the nearest integer and chooses the even integer at an exact tie. Positive and negative ties follow the same rule. Range checking applies to the final rounded value. Intermediate arithmetic must preserve the exact rational value.
A count of 4096 scaled points converts to 62 millipoints. A count of 12288 converts to 188. Their negatives convert to -62 and -188. One millipoint constructs 66 scaled points and negative one constructs -66.
Millipoint conversion can lose scaled-point precision. A conversion to millipoints and back need not recover the original length. The maximum point length converts to 140737488355328000 millipoints, which exceeds the fromMilliPoints input range.
The constructors require int arguments. A float or Length argument is rejected with TPZ5001. Physical conversions and scalar arithmetic do not provide an implicit integer constructor.
A constructor evaluates its argument once before checking the result range. A receiver conversion evaluates its receiver once. These operations perform no I/O or mutation and read no font or paragraph state.
A fromMilliPoints overflow is reported at the public constructor call. Earlier argument effects remain visible and later expressions do not execute.
Related rule: Convert physical lengths with toScaledPointsResult
The declared result type is int.
Effects
Failures
Result and effects
LinkConvert the exact stored physical distance to integer thousandths of a point with nearest-even rounding. Every stored point length has a representable result. Converting back can lose precision or exceed the constructor range.
Why
LinkMillipoint conversion makes the coarser integer boundary explicit. Nearest-even rounding preserves the shared Length conversion rule.
Related entries
LinkConvert physical lengths with toScaledPoints
LinkConvert physical lengths with toScaledPoints
Physical Length values with the Pt, Mm, Cm, or In marker provide toScaledPoints returning int. One point is 65,536 scaled points. The result is the exact stored signed 64-bit count.
The scaledPoints member is absent from every Length type. Calling that removed member is rejected with TPZ5006. Length<Em> has no toScaledPoints member and must resolve to a physical length first.
fromScaledPoints accepts every int from -9223372036854775808 through 9223372036854775807 inclusive. It returns Length<Pt> with that exact scaled-point count. Zero and negative inputs are valid. Construction performs no rounding and has no value-dependent failure.
fromMilliPoints interprets its int argument as thousandths of a point. Its scaled-point result is roundEven of the exact rational input times 8192 divided by 125.
fromMilliPoints accepts -140737488355328000 through 140737488355327999 inclusive. An input outside that range stops with runtime diagnostic TPZ4004. It does not return Result, wrap, saturate, or clamp.
Length<Pt>.toMilliPoints returns roundEven of the exact stored count times 125 divided by 8192. Every representable point length has a representable int result.
roundEven selects the nearest integer and chooses the even integer at an exact tie. Positive and negative ties follow the same rule. Range checking applies to the final rounded value. Intermediate arithmetic must preserve the exact rational value.
A count of 4096 scaled points converts to 62 millipoints. A count of 12288 converts to 188. Their negatives convert to -62 and -188. One millipoint constructs 66 scaled points and negative one constructs -66.
Millipoint conversion can lose scaled-point precision. A conversion to millipoints and back need not recover the original length. The maximum point length converts to 140737488355328000 millipoints, which exceeds the fromMilliPoints input range.
The constructors require int arguments. A float or Length argument is rejected with TPZ5001. Physical conversions and scalar arithmetic do not provide an implicit integer constructor.
A constructor evaluates its argument once before checking the result range. A receiver conversion evaluates its receiver once. These operations perform no I/O or mutation and read no font or paragraph state.
A fromMilliPoints overflow is reported at the public constructor call. Earlier argument effects remain visible and later expressions do not execute.
Why
Integer conversions use the same to prefix as unit conversions and collection conversions. Scaled points and millipoints remain distinct because they represent different units and rounding boundaries.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Convert every physical length unit to scaled points
Linkimport std.ioimport std.typeset as tslet pt = (1pt).toScaledPoints()let mm = (25.4mm).toScaledPoints()let cm = (2.54cm).toScaledPoints()let inch = (1in).toScaledPoints()io.writeLine("{pt}|{mm}|{cm}|{inch}|{ts.fromScaledPoints(pt) == 1pt}")
65536|4718592|4718592|4718592|true
Expected result
Expected result
Execution completes. Exit code 0.
65536|4718592|4718592|4718592|true
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Keep the millipoint conversion boundary
Linkimport std.ioimport std.typeset as tslet tie = ts.fromScaledPoints(4096).toMilliPoints()let rounded = ts.fromMilliPoints(1) == ts.fromScaledPoints(66)io.writeLine("{tie}|{rounded}")
62|true
Expected result
Expected result
Execution completes. Exit code 0.
62|true
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Reject scaledPoints on `Length<Pt>`
Linklet distance = 1ptdistance.scaledPoints()
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5006stdlib-removed-scaled-points atmain.tpz:2:10
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Reject scaledPoints on `Length<Mm>`
Linklet distance = 1mmdistance.scaledPoints()
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5006stdlib-removed-scaled-points atmain.tpz:2:10
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Reject scaledPoints on `Length<Cm>`
Linklet distance = 1cmdistance.scaledPoints()
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5006stdlib-removed-scaled-points atmain.tpz:2:10
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Reject scaledPoints on `Length<In>`
Linklet distance = 1indistance.scaledPoints()
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5006stdlib-removed-scaled-points atmain.tpz:2:10
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Resolve font-relative lengths before integer conversion
Linklet distance = 1emdistance.toScaledPoints()
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5006stdlib-unresolved-em-scaled-points atmain.tpz:2:10
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Read both endpoints of the exact integer representation
Linkimport std.typeset as tsimport std.iolet low = ts.fromScaledPoints(-9223372036854775808).toScaledPoints()let high = ts.fromScaledPoints(9223372036854775807).toScaledPoints()io.writeLine("{low}|{high}")
-9223372036854775808|9223372036854775807
Expected result
Expected result
Execution completes. Exit code 0.
-9223372036854775808|9223372036854775807
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Construct the millipoint endpoints and keep signed rounding
Linkimport std.typeset as tsimport std.iolet low = ts.fromMilliPoints(-140737488355328000)let high = ts.fromMilliPoints(140737488355327999)let negative = ts.fromMilliPoints(-1)let lowGrid = ts.fromScaledPoints(-9223372036854775808).toMilliPoints()let highGrid = ts.fromScaledPoints(9223372036854775807).toMilliPoints()io.writeLine("{low == -140737488355328pt}|{high == ts.fromScaledPoints(9223372036854775742)}|{negative == ts.fromScaledPoints(-66)}")io.writeLine("{lowGrid}|{highGrid}")
true|true|true -140737488355328000|140737488355328000
Expected result
Expected result
Execution completes. Exit code 0.
true|true|true-140737488355328000|140737488355328000
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Round both signs and both sides of a millipoint tie
Linkimport std.typeset as tsimport std.iolet below = ts.fromScaledPoints(4095).toMilliPoints()let tie = ts.fromScaledPoints(4096).toMilliPoints()let above = ts.fromScaledPoints(4097).toMilliPoints()let negativeBelow = ts.fromScaledPoints(-4095).toMilliPoints()let negativeTie = ts.fromScaledPoints(-4096).toMilliPoints()let negativeAbove = ts.fromScaledPoints(-4097).toMilliPoints()let upperTie = ts.fromScaledPoints(12288).toMilliPoints()let negativeUpperTie = ts.fromScaledPoints(-12288).toMilliPoints()io.writeLine("{below}|{tie}|{above}|{negativeBelow}|{negativeTie}|{negativeAbove}|{upperTie}|{negativeUpperTie}")
62|62|63|-62|-62|-63|188|-188
Expected result
Expected result
Execution completes. Exit code 0.
62|62|63|-62|-62|-63|188|-188
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Reject a millipoint input above the representable range
Linkimport std.typeset as tsts.fromMilliPoints(140737488355328000)
No stdout.
Expected result
Expected result
Rejection during run. Nonzero exit.
TPZ4004stdlib-length-unrepresentable atmain.tpz:2:1
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Reject a millipoint input below the representable range
Linkimport std.typeset as tsts.fromMilliPoints(-140737488355328001)
No stdout.
Expected result
Expected result
Rejection during run. Nonzero exit.
TPZ4004stdlib-length-unrepresentable atmain.tpz:2:1
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Require an int for fromScaledPoints
Linkimport std.typeset as tsts.fromScaledPoints(1.0)
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5001stdlib-length-int-required atmain.tpz:2:21
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi
Require an int for fromMilliPoints
Linkimport std.typeset as tsts.fromMilliPoints(1.0)
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5001stdlib-length-int-required atmain.tpz:2:20
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 1303 - compiler/crates/topaz_value/src/value/length.rs at
271329b482bc· 122 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 92 - compiler/crates/topaz_syntax/src/length.rs at
271329b482bc· 293 - compiler/crates/topaz_resolve/src/std/typeset/length.tpz at
271329b482bc· 2 - compiler/crates/topaz_self_frontend/topaz/checker/expression_core.tpz at
271329b482bc· 1511 - compiler/crates/topaz_self_frontend/src/request.rs at
b48527d0a174· 63-95 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 19-29 - compiler/crates/topaz_self_frontend/topaz/length.tpz at
b48527d0a174· 94-99 - compiler/crates/topaz_syntax/src/length.rs at
b48527d0a174· 293-302 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 43-55 - compiler/crates/topaz_value/src/value/length.rs at
b48527d0a174· 152-172 - compiler/crates/topaz_product_runtime/src/program/validate.rs at
b48527d0a174· 38-89 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 646-648 - compiler/crates/topaz_product_runtime/src/runtime/call.rs at
b48527d0a174· 1320-1330 - compiler/crates/topaz_product_runtime/src/runtime/machine.rs at
b48527d0a174· 490-499 - compiler/crates/topaz_product_runtime/src/wire.rs at
b48527d0a174· 42-49 -
topaz.stdlib.contract.to-scaled-pointsatworking-tree - topaz.decision.to-scaled-points.1 at
topaz.decisi