Browse Source

main: add basic float tests

pull/28/head
Ayke van Laethem 6 years ago
parent
commit
c1a833c7cc
No known key found for this signature in database GPG Key ID: E97FF5335DFDFDED
  1. 26
      testdata/float.go
  2. 13
      testdata/float.txt

26
testdata/float.go

@ -0,0 +1,26 @@
package main
func main() {
// sanity
println(3.14159265358979323846)
// float64
f64 := float64(2) / float64(3)
println(f64)
println(f64 + 1.0)
println(f64 - 1.0)
println(f64 * 2.0)
println(f64 / 2.0)
// float32
f32 := float32(2) / float32(3)
println(f32)
println(f32 + 1.0)
println(f32 - 1.0)
println(f32 * 2.0)
println(f32 / 2.0)
// casting
println(float32(f64))
println(float64(f32))
}

13
testdata/float.txt

@ -0,0 +1,13 @@
+3.141593e+000
+6.666667e-001
+1.666667e+000
-3.333333e-001
+1.333333e+000
+3.333333e-001
+6.666667e-001
+1.666667e+000
-3.333333e-001
+1.333333e+000
+3.333333e-001
+6.666667e-001
+6.666667e-001
Loading…
Cancel
Save