mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
math: add round_sig function for f64 (#14997)
This commit is contained in:
@ -808,6 +808,17 @@ fn test_round() {
|
||||
}
|
||||
}
|
||||
|
||||
fn fn_test_round_sig() {
|
||||
assert round_sig(4.3239437319748394, -1) == 4.3239437319748394
|
||||
assert round_sig(4.3239437319748394, 0) == 4.0000000000000000
|
||||
assert round_sig(4.3239437319748394, 1) == 4.3000000000000000
|
||||
assert round_sig(4.3239437319748394, 2) == 4.3200000000000000
|
||||
assert round_sig(4.3239437319748394, 3) == 4.3240000000000000
|
||||
assert round_sig(4.3239437319748394, 6) == 4.3239440000000000
|
||||
assert round_sig(4.3239437319748394, 12) == 4.323943731975
|
||||
assert round_sig(4.3239437319748394, 17) == 4.3239437319748394
|
||||
}
|
||||
|
||||
fn test_sin() {
|
||||
for i := 0; i < math.vf_.len; i++ {
|
||||
f := sin(math.vf_[i])
|
||||
|
Reference in New Issue
Block a user