Skip to content

Math epic - Part 1#763

Open
shantanu-sardesai wants to merge 10 commits into
jank-lang:mainfrom
shantanu-sardesai:issues/636-math-epic
Open

Math epic - Part 1#763
shantanu-sardesai wants to merge 10 commits into
jank-lang:mainfrom
shantanu-sardesai:issues/636-math-epic

Conversation

@shantanu-sardesai
Copy link
Copy Markdown
Contributor

@shantanu-sardesai shantanu-sardesai commented May 9, 2026

Requires a Clojure test suite repoint (jank-lang/clojure-test-suite#875). Done.

Brings us to 125 of 231 tests. Goal is to get to 145, covering all "math" clojure.core functions with tests in the test suite.

Comment thread compiler+runtime/src/cpp/jank/runtime/core/math.cpp Outdated
Comment thread compiler+runtime/src/cpp/jank/runtime/core/math.cpp Outdated
Comment thread compiler+runtime/src/cpp/jank/runtime/core/math.cpp Outdated
@shantanu-sardesai shantanu-sardesai force-pushed the issues/636-math-epic branch 2 times, most recently from f16d26f to 7fcb947 Compare May 10, 2026 16:29
shantanu-sardesai added a commit to shantanu-sardesai/jank that referenced this pull request May 10, 2026
Resolves the following thread(s):
- jank-lang#763 (comment).
shantanu-sardesai added a commit to shantanu-sardesai/jank that referenced this pull request May 10, 2026
Resolves the following thread(s):
- jank-lang#763 (comment).
shantanu-sardesai added a commit to shantanu-sardesai/jank that referenced this pull request May 10, 2026
Resolves the following thread(s):
- jank-lang#763 (comment).
shantanu-sardesai added a commit to shantanu-sardesai/jank that referenced this pull request May 10, 2026
Resolves the following thread(s):
- jank-lang#763 (comment).
shantanu-sardesai added a commit to shantanu-sardesai/jank that referenced this pull request May 10, 2026
Resolves the following thread(s):
- jank-lang#763 (comment).
shantanu-sardesai added a commit to shantanu-sardesai/jank that referenced this pull request May 10, 2026
Resolves the following thread(s):
- jank-lang#763 (comment).
@shantanu-sardesai shantanu-sardesai requested a review from jeaye May 10, 2026 16:47
Comment thread compiler+runtime/include/cpp/jank/runtime/core/math.hpp Outdated
Comment thread compiler+runtime/src/cpp/jank/runtime/core/math.cpp Outdated
Comment thread compiler+runtime/src/cpp/jank/runtime/core/math.cpp Outdated
shantanu-sardesai added a commit to shantanu-sardesai/jank that referenced this pull request May 13, 2026
Resolves the following thread(s):
- jank-lang#763 (comment).

bool real::equal(object const &o) const
{
if(is_nan(this) || is_nan(&o))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is UB, since we need detail::untagged for raw pointers, due to the recent NaN boxing changes. Please read the big comment block in oref.hpp for details.

We need it for both this and &o. Most likely, this will just crash right now.

Also, we shouldn't use is_nan for this, since that would require building an object_ref, visiting that, and then actually checking isnan. Since we have data already, let's just check directly. Arithmetic operations are one of the most important parts in the jank runtime to keep fast, so keep that in mind. That also means we could use isnan and avoid a duplicate visit on o if we do it later in the fn.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, why is this not working by default?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants