1 Test for floating point.
10 :$put =printf('%f', 123.456)
11 :$put =printf('%e', 123.456)
12 :$put =printf('%g', 123.456)
13 :" check we don't crash on division by zero
18 :$put =printf('%g', v)
21 :$put =printf('%g', v)
30 :$put =printf('%g', 4 + 1.234)
31 :$put =printf('%g', 1.234 - 8)
33 :$put =printf('%g', 4 * 1.234)
34 :$put =printf('%g', 4.0 / 1234)
36 :$put =string({'x': 1.234, 'y': -2.0e20})
38 :$put =string([-123.4, 2.0e-20])
40 :$put =printf('%d', abs(1456))
41 :$put =printf('%d', abs(-4))
42 :$put =printf('%d', abs([1, 2, 3]))
43 :$put =printf('%g', abs(14.56))
44 :$put =printf('%g', abs(-54.32))
46 :$put =printf('%g', ceil(1.456))
47 :$put =printf('%g', ceil(-5.456))
48 :$put =printf('%g', ceil(-4.000))
50 :$put =printf('%g', floor(1.856))
51 :$put =printf('%g', floor(-5.456))
52 :$put =printf('%g', floor(4.0))
54 :$put =printf('%g', log10(1000))
55 :$put =printf('%g', log10(0.01000))
57 :$put =printf('%g', pow(3, 3.0))
58 :$put =printf('%g', pow(2, 16))
60 :$put =printf('%g', round(0.456))
61 :$put =printf('%g', round(4.5))
62 :$put =printf('%g', round(-4.50))
64 :$put =printf('%g', sqrt(100))
67 :$put =printf('%g', str2float('1e40'))
69 :$put =printf('%g', trunc(1.456))
70 :$put =printf('%g', trunc(-5.456))
71 :$put =printf('%g', trunc(4.000))
73 :$put =float2nr(123.456)
74 :$put =float2nr(-123.456)
75 :/^Results/,$wq! test.out