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

expression: set floats as f64 by default

This commit is contained in:
SleepyRoy
2020-03-19 14:24:49 +08:00
committed by GitHub
parent 969765435e
commit f798a0937a
10 changed files with 77 additions and 30 deletions

View File

@@ -190,10 +190,10 @@ fn test_repeat() {
assert a[9] == 123
}
{
a := [f64(1.1)].repeat(10)
assert a[0] == f64(1.1)
assert a[5] == f64(1.1)
assert a[9] == f64(1.1)
a := [1.1].repeat(10)
assert a[0] == 1.1
assert a[5] == 1.1
assert a[9] == 1.1
}
{
a := [1, 2].repeat(2)
@@ -501,7 +501,7 @@ fn test_sort() {
}
fn test_f32_sort() {
mut f := [50.0, 15, 1, 79, 38, 0, 27]
mut f := [f32(50.0), 15, 1, 79, 38, 0, 27]
f.sort_with_compare(compare_f32)
assert f[0] == 0.0
assert f[1] == 1.0
@@ -509,7 +509,7 @@ fn test_f32_sort() {
}
fn test_f64_sort() {
mut f := [f64(50.0), 15, 1, 79, 38, 0, 27]
mut f := [50.0, 15, 1, 79, 38, 0, 27]
f.sort_with_compare(compare_f64)
assert f[0] == 0.0
assert f[1] == 1.0