Fix rat_set_f64
This commit is contained in:
1 parent
85f8c8df91
commit
84b84d9f7d
1 file changed
+5
-5
@@ -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