ludic/examples/lang/long_literals.ludic
Orkuncakilkaya 19fcf60599 wip(0.S3): packages and examples migrated again from their pre-0.S sources in one run
ludic migrate state packages <every example program> packages/ludic.lab/example/plate.ludic
  1804 vars into 126 states, 64 into lets; 23498 edits in 460 files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 15:31:34 +03:00

16 lines
680 B
Text

# long_literals.ludic — a decimal literal past 2^31 - 1 is a long and keeps its value; so is a hex
# literal of more than eight digits (past 2^63 it wraps, as the bits say). Eight hex digits or
# fewer stay a 32-bit pattern (0xFFFFFFFF is -1, as it always was).
#
# Running it prints: 4294967295 3988292384 -4294967296 1099511627776 -3750763034362895579 -1 1
program LongLiterals {
const MASK: long = 4294967295
let poly: long = 3988292384
function neg() -> long { return -4294967296 }
entry {
let big = 0x10000000000
let fnv = 0xcbf29ce484222325
let small = 0xFFFFFFFF
print(`{MASK} {poly} {neg()} {big} {fnv} {small} {MASK > long(2147483647)}`)
}
}