Skip to content

Conversation

@shantanu-sardesai
Copy link
Contributor

@shantanu-sardesai shantanu-sardesai commented Nov 14, 2025

Initial work at arithmetic promotion. The PR still requires tests but I'm creating this so that I can get some early feedback, especially on the overflow detection logic.

Requires a repoint.


Resolves #359, #604.

@shantanu-sardesai shantanu-sardesai force-pushed the issues/359-auto-promotion branch from 82e1d75 to 19d08bc Compare November 14, 2025 12:11
@shantanu-sardesai shantanu-sardesai marked this pull request as draft November 14, 2025 12:34
@shantanu-sardesai
Copy link
Contributor Author

I'll also aim to add missing Clojure test suite test cases for some of the arithmetic promotion operators.

@shantanu-sardesai
Copy link
Contributor Author

shantanu-sardesai commented Nov 14, 2025

Interestingly enough it looks like Clojure doesn't seem to support automatic arithmetic promotion from a java.lang.Double to java.math.BigDecimal, although I've yet to receive confirmation on whether that is really the case or not. Anyone with more information or interested in the topic can follow or chime in on the discussion here.

@shantanu-sardesai
Copy link
Contributor Author

Interestingly enough it looks like Clojure doesn't seem to support automatic arithmetic promotion from a java.lang.Double to java.math.BigDecimal, although I've yet to receive confirmation on whether that is really the case or not. Anyone with more information or interested in the topic can follow or chime in on the discussion here.

Seems like Clojure intentionally chooses to not promote to BigDecimal since the promotion is to account for scale and Decimal is large enough.

@shantanu-sardesai shantanu-sardesai marked this pull request as ready for review November 25, 2025 18:16
Copy link
Member

@jeaye jeaye left a comment

Choose a reason for hiding this comment

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

The changes look good. CI is failing, though.

@shantanu-sardesai shantanu-sardesai force-pushed the issues/359-auto-promotion branch from f78df29 to 22fd3dd Compare December 1, 2025 14:24
@shantanu-sardesai
Copy link
Contributor Author

CI fails due to: jank-lang/clojure-test-suite#828 (comment).

@shantanu-sardesai
Copy link
Contributor Author

shantanu-sardesai commented Dec 1, 2025

I've commented the Clojure test suite test cases for these operators, the CI passes now.

@shantanu-sardesai shantanu-sardesai force-pushed the issues/359-auto-promotion branch from 22fd3dd to 9a39ef7 Compare December 2, 2025 15:07
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

Successfully merging this pull request may close these issues.

Add support for promoting arithmetic

2 participants