mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt: remove redundant parenthesis in the complex infix expr (#17873)
This commit is contained in:
@ -243,7 +243,7 @@ fn f64_to_decimal(mant u64, exp u64) Dec64 {
|
||||
vr_div_10 := vr / 10
|
||||
vr_mod_10 := vr % 10
|
||||
vm_is_trailing_zeros = vm_is_trailing_zeros && vm_mod_10 == 0
|
||||
vr_is_trailing_zeros = vr_is_trailing_zeros && (last_removed_digit == 0)
|
||||
vr_is_trailing_zeros = vr_is_trailing_zeros && last_removed_digit == 0
|
||||
last_removed_digit = u8(vr_mod_10)
|
||||
vr = vr_div_10
|
||||
vp = vp_div_10
|
||||
@ -260,7 +260,7 @@ fn f64_to_decimal(mant u64, exp u64) Dec64 {
|
||||
vp_div_10 := vp / 10
|
||||
vr_div_10 := vr / 10
|
||||
vr_mod_10 := vr % 10
|
||||
vr_is_trailing_zeros = vr_is_trailing_zeros && (last_removed_digit == 0)
|
||||
vr_is_trailing_zeros = vr_is_trailing_zeros && last_removed_digit == 0
|
||||
last_removed_digit = u8(vr_mod_10)
|
||||
vr = vr_div_10
|
||||
vp = vp_div_10
|
||||
@ -268,7 +268,7 @@ fn f64_to_decimal(mant u64, exp u64) Dec64 {
|
||||
removed++
|
||||
}
|
||||
}
|
||||
if vr_is_trailing_zeros && (last_removed_digit == 5) && (vr % 2) == 0 {
|
||||
if vr_is_trailing_zeros && last_removed_digit == 5 && (vr % 2) == 0 {
|
||||
// Round even if the exact number is .....50..0.
|
||||
last_removed_digit = 4
|
||||
}
|
||||
@ -325,7 +325,7 @@ pub fn f64_to_str(f f64, n_digit int) string {
|
||||
// println("s:${neg} mant:${mant} exp:${exp} float:${f} byte:${u1.u:016lx}")
|
||||
|
||||
// Exit early for easy cases.
|
||||
if (exp == maxexp64) || (exp == 0 && mant == 0) {
|
||||
if exp == maxexp64 || (exp == 0 && mant == 0) {
|
||||
return get_string_special(neg, exp == 0, mant == 0)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user