mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 23:58:50 +00:00
big.Rat (Experimental)
This commit is contained in:
@@ -152,9 +152,18 @@ int_mul :: proc(dest, src, multiplier: ^Int, allocator := context.allocator) ->
|
||||
return #force_inline internal_int_mul(dest, src, multiplier)
|
||||
}
|
||||
|
||||
mul :: proc { int_mul, int_mul_digit, }
|
||||
mul :: proc {
|
||||
int_mul,
|
||||
int_mul_digit,
|
||||
rat_mul_rat,
|
||||
rat_mul_int,
|
||||
int_mul_rat,
|
||||
}
|
||||
|
||||
int_sqr :: proc(dest, src: ^Int) -> (err: Error) { return mul(dest, src, src) }
|
||||
rat_sqr :: proc(dest, src: ^Rat) -> (err: Error) { return mul(dest, src, src) }
|
||||
sqr :: proc { int_sqr, rat_sqr }
|
||||
|
||||
sqr :: proc(dest, src: ^Int) -> (err: Error) { return mul(dest, src, src) }
|
||||
|
||||
/*
|
||||
divmod.
|
||||
@@ -200,7 +209,13 @@ int_div_digit :: proc(quotient, numerator: ^Int, denominator: DIGIT, allocator :
|
||||
_ = #force_inline internal_divmod(quotient, numerator, denominator) or_return
|
||||
return
|
||||
}
|
||||
div :: proc { int_div, int_div_digit, }
|
||||
div :: proc {
|
||||
int_div,
|
||||
int_div_digit,
|
||||
rat_div_rat,
|
||||
rat_div_int,
|
||||
int_div_rat,
|
||||
}
|
||||
|
||||
/*
|
||||
remainder = numerator % denominator.
|
||||
|
||||
Reference in New Issue
Block a user