Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for big_decimal and big_integer objects #281

Open
jeaye opened this issue Feb 19, 2025 · 0 comments
Open

Add support for big_decimal and big_integer objects #281

jeaye opened this issue Feb 19, 2025 · 0 comments
Assignees

Comments

@jeaye
Copy link
Member

jeaye commented Feb 19, 2025

Overview

Clojure supports BigInt and BigDecimal as numbers which can grow arbitrarily. There is also lexing support for both of these, such that the N suffix on an integer creates a BigInt and the M suffix creates a BigDecimal.

Steps

  • Determine if we're implementing these ourselves or bringing in a library
    • Explore libraries and determine best options based on run-time and compile-time performance
    • Add the lib as a submodule and hook it into cmake, if we are adding one
  • Add big_integer and big_decimal objects
  • Update C API with jank_create_big_integer and jank_create_big_decimal to aid in LLVM IR gen
  • Add operator overloads for them (follow ratio)
  • Don't worry about all of the math overloads for them for now; those aren't being used with LLVM IR gen right now anyway
  • Add lexing support for N and M suffixes, with tests
  • Update numeric lexing for integers to automatically use a big_integer if the number is too large for a native_integer, with tests
  • Update clojure.core/integer? and runtime::is_integer
  • Add clojure.core/bigint, clojure.core/biginteger, clojure.core/bigdec, clojure.core/decimal?
  • Update ratio object to use big_integer for its parts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants