GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Large integer literals between 2^53 and 2^63 emit as rounded Lua 5.3+ integers · Issue #1734 · TypeScriptToLua/TypeScriptToLua

Large integer literals between 2^53 and 2^63 emit as rounded Lua 5.3+ integers #1734

New issue
Copy link
New issue
Copy link
Open
#1740
Open
Large integer literals between 2^53 and 2^63 emit as rounded Lua 5.3+ integers#1734
#1740
Copy link

Description

@trackoor
trackoor
opened on Nov 7, 2026
Issue body actions

In typescript-to-lua 1.37.1 targeting Lua 5.3+, integer-valued numeric literals above Number.MAX_SAFE_INTEGER (2^53 - 1) are formatted with JavaScript's String(value) without a decimal point or exponent. Because String() rounds to 16–17 significant digits while omitting .0, Lua 5.3+ parses the output as a 64-bit integer with a different value than the original IEEE-754 double.

const a = 4611686018427387904; // 2 ** 62 (exact IEEE-754 double)
console.log(a === 2 ** 62);
console.log(a % 1000);

Transpiling with luaTarget: "5.4" emits a = 4611686018427388000, and running on Lua 5.3+ prints false and 0, whereas Node.js (and Lua 5.1/5.2/LuaJIT, where all numbers are floats) prints true and 904. In Lua 5.3+, 4611686018427388000 is parsed as an exact 64-bit integer that is 96 larger than 2^62, so a == 2 ^ 62 evaluates to false under Lua's exact integer-float comparison.

Credit: https://ucsbplse.github.io/

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.