Created
April 10, 2017 16:34
-
-
Save gonzaloserrano/70ec86742536e42512c5a79d50d8bf20 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math" | |
"os" | |
) | |
func main() { | |
var vf = []float64{ | |
4.9790119248836735e+00, | |
7.7388724745781045e+00, | |
-2.7688005719200159e-01, | |
-5.0106036182710749e+00, | |
9.6362937071984173e+00, | |
2.9263772392439646e+00, | |
5.2290834314593066e+00, | |
2.7279399104360102e+00, | |
1.8253080916808550e+00, | |
-8.6859247685756013e+00, | |
} | |
var ceil = []float64{ | |
5.0000000000000000e+00, | |
8.0000000000000000e+00, | |
0.0000000000000000e+00, | |
-5.0000000000000000e+00, | |
1.0000000000000000e+01, | |
3.0000000000000000e+00, | |
6.0000000000000000e+00, | |
3.0000000000000000e+00, | |
2.0000000000000000e+00, | |
-8.0000000000000000e+00, | |
} | |
for i := 0; i < len(vf); i++ { | |
println(math.Ceil(vf[i]), int(math.Ceil(vf[i])), int(vf[i])) | |
if f := math.Ceil(vf[i]); ceil[i] != f { | |
fmt.Sprintf("Ceil(%g) = %g, want %g", vf[i], f, ceil[i]) | |
os.Exit(1) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
result: