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 runtime ratio object #137

Merged
merged 4 commits into from
Dec 10, 2024
Merged

Conversation

jianlingzhong
Copy link
Contributor

@jianlingzhong jianlingzhong commented Nov 24, 2024

everything should work.

❯ build/jank repl
Bottom of clojure.core
clojure.core=> (+ 1/2 1/3)
5/6
clojure.core=> (- 1/2 1/3)
1/6
clojure.core=> (* 1/2 1/3)
1/6
clojure.core=> (/ 1/2 1/3)
3/2
clojure.core=> (+ 1/2 1/2)
1
clojure.core=> (+ 1/2 1)
3/2
clojure.core=> (+ 1 1/3)
4/3
clojure.core=> (+ 1.0 1/3)
1.3333333333333333
clojure.core=> (+ 1.0 -1/3)
0.6666666666666667
clojure.core=> (* 1.0 -1/3)
-0.3333333333333333
clojure.core=> (> 1 1/3)
true
clojure.core=> (< 1 1/3)
false
clojure.core=> (== 1 1/1)
true
clojure.core=> (== 2 1/2)
false
clojure.core=> (mod 4/5 2)
0.8
clojure.core=> (mod 0.8 2)
0.8
clojure.core=> (mod 16/5 2)
1.2000000000000002
clojure.core=> (mod 16/5 3/2)
0.20000000000000018
clojure.core=> (mod (/ 16.0 5) (/ 3.0 2))
0.20000000000000018
clojure.core=> (<= (/ 1.0 3) 1/3)
true
clojure.core=> (== 1/3 0.3333)
false
clojure.core=> (== 1/3 0.3333333333333333333333)
true

this closes #66.

@jianlingzhong jianlingzhong force-pushed the ratio branch 2 times, most recently from e2d82f4 to 8bb4005 Compare November 25, 2024 07:20
@jianlingzhong jianlingzhong force-pushed the ratio branch 4 times, most recently from 3dc71dd to dc6ddef Compare November 30, 2024 05:55
Comment on lines 185 to 189
for(auto const f : failures)
{
std::cout << f.path << std::endl;
std::cout << f.error << std::endl;
}
Copy link
Member

Choose a reason for hiding this comment

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

Why is this here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be removed now.

Comment on lines 5 to 6
git_root=$(git rev-parse --show-toplevel)
"$git_root"/compiler+runtime/bin/format
Copy link
Member

Choose a reason for hiding this comment

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

Please use a pre-commit hook for this instead. Nobody else needs this hooked into the compile script; our editors are running the formatter for us.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed.

Comment on lines 161 to 165
native_integer radix{ 10 };
/* The 'r' used in arbitrary radix (prefixed with N and then r, where N is the radix (2 <= radix <= 36); */
/* e.g. 2r10101 for binary, 16rebed00d for hex) */
native_bool found_r{};
/* Whether the previous token requires a space after it. */
Copy link
Member

Choose a reason for hiding this comment

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

This was a ratio PR, but it now contains some of your radix changes too. Any reason these were merged, especially when you have a separate radix PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i dropped the integer related commit.

@jianlingzhong jianlingzhong requested a review from jeaye December 9, 2024 07:40
@jeaye jeaye merged commit c776a47 into jank-lang:main Dec 10, 2024
1 of 4 checks passed
@jeaye
Copy link
Member

jeaye commented Dec 10, 2024

Nice work, Jianling!

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 ratio support
2 participants