Skip to content

rat_mul_rat: fix squaring path writing the denominator into the numerator - #7624

Merged
Kelimion merged 1 commit into
odin-lang:masterfrom
louisnovy:rat-mul-rat-squaring
Sep 24, 2026
Merged

Kelimion merged 1 commit into
odin-lang:masterfrom
louisnovy:rat-mul-rat-squaring

Conversation

@louisnovy

Copy link
Copy Markdown
Contributor

No description provided.

@Kelimion

Copy link
Copy Markdown
Member

Good find. Thanks for the fix and test.

Apropos of the latter, because we know the numerator and denominator are small, we don't need the string conversion:

for r in ([]^big.Rat{&square, &x}) {
	num, _ := big.int_get_i64(&r.a)
	testing.expect_value(t, num, 4)

	den, _ := big.int_get_i64(&r.b)
	testing.expect_value(t, den, 9)
}

Just for future reference. It works fine as-is, so I'll merge it.

@Kelimion
Kelimion merged commit f1fd033 into odin-lang:master Sep 24, 2026
7 checks passed
@louisnovy
louisnovy deleted the rat-mul-rat-squaring branch September 24, 2026 13:40
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.

2 participants