mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-25 15:05:00 -07:00
Fix rat_set_f64
This commit is contained in:
@@ -42,9 +42,9 @@ rat_set_f64 :: proc(dst: ^Rat, f: f64, allocator := context.allocator) -> (err:
|
||||
dst.a.sign = .Negative if f < 0 else .Zero_or_Positive
|
||||
|
||||
if shift > 0 {
|
||||
internal_int_shl_digit(&dst.b, shift) or_return
|
||||
internal_int_shl(&dst.b, &dst.b, shift) or_return
|
||||
} else {
|
||||
internal_int_shl_digit(&dst.a, -shift) or_return
|
||||
internal_int_shl(&dst.a, &dst.a, -shift) or_return
|
||||
}
|
||||
|
||||
return internal_rat_norm(dst)
|
||||
@@ -389,9 +389,9 @@ internal_rat_to_float :: proc($T: typeid, z: ^Rat, allocator := context.allocato
|
||||
internal_int_abs(b2, b) or_return
|
||||
|
||||
if shift := MSIZE2 - exp; shift > 0 {
|
||||
internal_int_shl_digit(a2, shift) or_return
|
||||
} else {
|
||||
internal_int_shl_digit(b2, -shift) or_return
|
||||
internal_int_shl(a2, a2, shift) or_return
|
||||
} else if shift < 0 {
|
||||
internal_int_shl(b2, b2, -shift) or_return
|
||||
}
|
||||
|
||||
q, r := &Int{}, &Int{}
|
||||
|
||||
Reference in New Issue
Block a user