1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

builtin: vfmt every .v file, except vlib/builtin/int_test.v (#9448)

This commit is contained in:
zakuro
2021-03-25 03:39:59 +09:00
committed by GitHub
parent 5d8b9b0151
commit 6bc9ef7373
19 changed files with 259 additions and 272 deletions

View File

@ -88,66 +88,42 @@ pub fn (x f32) strlong() string {
// Example: assert f32_abs(-2.0) == 2.0
[inline]
pub fn f32_abs(a f32) f32 {
return if a < 0 {
-a
} else {
a
}
return if a < 0 { -a } else { a }
}
// f64_abs returns the absolute value of `a` as a `f64` value.
// Example: assert f64_abs(-2.0) == f64(2.0)
[inline]
fn f64_abs(a f64) f64 {
return if a < 0 {
-a
} else {
a
}
return if a < 0 { -a } else { a }
}
// f32_max returns the largest `f32` of input `a` and `b`.
// Example: assert f32_max(2.0,3.0) == 3.0
[inline]
pub fn f32_max(a f32, b f32) f32 {
return if a > b {
a
} else {
b
}
return if a > b { a } else { b }
}
// f32_min returns the smallest `f32` of input `a` and `b`.
// Example: assert f32_min(2.0,3.0) == 2.0
[inline]
pub fn f32_min(a f32, b f32) f32 {
return if a < b {
a
} else {
b
}
return if a < b { a } else { b }
}
// f64_max returns the largest `f64` of input `a` and `b`.
// Example: assert f64_max(2.0,3.0) == 3.0
[inline]
pub fn f64_max(a f64, b f64) f64 {
return if a > b {
a
} else {
b
}
return if a > b { a } else { b }
}
// f64_min returns the smallest `f64` of input `a` and `b`.
// Example: assert f64_min(2.0,3.0) == 2.0
[inline]
fn f64_min(a f64, b f64) f64 {
return if a < b {
a
} else {
b
}
return if a < b { a } else { b }
}
// eq_epsilon returns true if the `f32` is equal to input `b`.