annotate src/testdir/test_float_func.vim @ 16668:81be817c9d9a v8.1.1336

patch 8.1.1336: some eval functionality is not covered by tests commit https://github.com/vim/vim/commit/17aca707f92235b6f962e637e8073162d18e6de2 Author: Bram Moolenaar <Bram@vim.org> Date: Thu May 16 22:24:55 2019 +0200 patch 8.1.1336: some eval functionality is not covered by tests Problem: Some eval functionality is not covered by tests. Solution: Add a few more test cases. (Masato Nishihata, closes https://github.com/vim/vim/issues/4374)
author Bram Moolenaar <Bram@vim.org>
date Thu, 16 May 2019 22:30:06 +0200
parents 2c33b119ba92
children f38fcbf343ce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " test float functions
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 if !has('float')
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 finish
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 end
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 func Test_abs()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
8 call assert_equal('1.23', string(abs(1.23)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
9 call assert_equal('1.23', string(abs(-1.23)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
10 call assert_equal('0.0', string(abs(0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
11 call assert_equal('0.0', string(abs(1.0/(1.0/0.0))))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
12 call assert_equal('0.0', string(abs(-1.0/(1.0/0.0))))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
13 call assert_equal('inf', string(abs(1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
14 call assert_equal('inf', string(abs(-1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
15 call assert_equal('nan', string(abs(0.0/0.0)))
16668
81be817c9d9a patch 8.1.1336: some eval functionality is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 16213
diff changeset
16 call assert_equal('12', string(abs('12abc')))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
17 call assert_equal('12', string(abs('-12abc')))
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
18 call assert_fails("call abs([])", 'E745:')
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
19 call assert_fails("call abs({})", 'E728:')
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
20 call assert_fails("call abs(function('string'))", 'E703:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 func Test_sqrt()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
24 call assert_equal('0.0', string(sqrt(0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
25 call assert_equal('1.414214', string(sqrt(2.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
26 call assert_equal('inf', string(sqrt(1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
27 call assert_equal('nan', string(sqrt(-1.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
28 call assert_equal('nan', string(sqrt(0.0/0.0)))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
29 call assert_fails('call sqrt("")', 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 func Test_log()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
33 call assert_equal('0.0', string(log(1.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
34 call assert_equal('-0.693147', string(log(0.5)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
35 call assert_equal('-inf', string(log(0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
36 call assert_equal('nan', string(log(-1.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
37 call assert_equal('inf', string(log(1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
38 call assert_equal('nan', string(log(0.0/0.0)))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
39 call assert_fails('call log("")', 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 func Test_log10()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
43 call assert_equal('0.0', string(log10(1.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
44 call assert_equal('2.0', string(log10(100.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
45 call assert_equal('2.079181', string(log10(120.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
46 call assert_equal('-inf', string(log10(0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
47 call assert_equal('nan', string(log10(-1.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
48 call assert_equal('inf', string(log10(1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
49 call assert_equal('nan', string(log10(0.0/0.0)))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
50 call assert_fails('call log10("")', 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 func Test_exp()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
54 call assert_equal('1.0', string(exp(0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
55 call assert_equal('7.389056', string(exp(2.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
56 call assert_equal('0.367879', string(exp(-1.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
57 call assert_equal('inf', string(exp(1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
58 call assert_equal('0.0', string(exp(-1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
59 call assert_equal('nan', string(exp(0.0/0.0)))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
60 call assert_fails('call exp("")', 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 func Test_sin()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
64 call assert_equal('0.0', string(sin(0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
65 call assert_equal('0.841471', string(sin(1.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
66 call assert_equal('-0.479426', string(sin(-0.5)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
67 call assert_equal('nan', string(sin(0.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
68 call assert_equal('nan', string(sin(1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
69 call assert_equal('0.0', string(sin(1.0/(1.0/0.0))))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
70 call assert_equal('-0.0', string(sin(-1.0/(1.0/0.0))))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
71 call assert_fails('call sin("")', 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 func Test_asin()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
75 call assert_equal('0.0', string(asin(0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
76 call assert_equal('1.570796', string(asin(1.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
77 call assert_equal('-0.523599', string(asin(-0.5)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
78 call assert_equal('nan', string(asin(1.1)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
79 call assert_equal('nan', string(asin(1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
80 call assert_equal('nan', string(asin(0.0/0.0)))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
81 call assert_fails('call asin("")', 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 func Test_sinh()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
85 call assert_equal('0.0', string(sinh(0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
86 call assert_equal('0.521095', string(sinh(0.5)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
87 call assert_equal('-1.026517', string(sinh(-0.9)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
88 call assert_equal('inf', string(sinh(1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
89 call assert_equal('-inf', string(sinh(-1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
90 call assert_equal('nan', string(sinh(0.0/0.0)))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
91 call assert_fails('call sinh("")', 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 func Test_cos()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
95 call assert_equal('1.0', string(cos(0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
96 call assert_equal('0.540302', string(cos(1.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
97 call assert_equal('0.877583', string(cos(-0.5)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
98 call assert_equal('nan', string(cos(0.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
99 call assert_equal('nan', string(cos(1.0/0.0)))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
100 call assert_fails('call cos("")', 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 func Test_acos()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
104 call assert_equal('1.570796', string(acos(0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
105 call assert_equal('0.0', string(acos(1.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
106 call assert_equal('3.141593', string(acos(-1.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
107 call assert_equal('2.094395', string(acos(-0.5)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
108 call assert_equal('nan', string(acos(1.1)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
109 call assert_equal('nan', string(acos(1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
110 call assert_equal('nan', string(acos(0.0/0.0)))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
111 call assert_fails('call acos("")', 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 func Test_cosh()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
115 call assert_equal('1.0', string(cosh(0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
116 call assert_equal('1.127626', string(cosh(0.5)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
117 call assert_equal('inf', string(cosh(1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
118 call assert_equal('inf', string(cosh(-1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
119 call assert_equal('nan', string(cosh(0.0/0.0)))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
120 call assert_fails('call cosh("")', 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 func Test_tan()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
124 call assert_equal('0.0', string(tan(0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
125 call assert_equal('0.546302', string(tan(0.5)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
126 call assert_equal('-0.546302', string(tan(-0.5)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
127 call assert_equal('nan', string(tan(1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
128 call assert_equal('nan', string(cos(0.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
129 call assert_equal('0.0', string(tan(1.0/(1.0/0.0))))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
130 call assert_equal('-0.0', string(tan(-1.0/(1.0/0.0))))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
131 call assert_fails('call tan("")', 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134 func Test_atan()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
135 call assert_equal('0.0', string(atan(0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
136 call assert_equal('0.463648', string(atan(0.5)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
137 call assert_equal('-0.785398', string(atan(-1.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
138 call assert_equal('1.570796', string(atan(1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
139 call assert_equal('-1.570796', string(atan(-1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
140 call assert_equal('nan', string(atan(0.0/0.0)))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
141 call assert_fails('call atan("")', 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 func Test_atan2()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
145 call assert_equal('-2.356194', string(atan2(-1, -1)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
146 call assert_equal('2.356194', string(atan2(1, -1)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
147 call assert_equal('0.0', string(atan2(1.0, 1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
148 call assert_equal('1.570796', string(atan2(1.0/0.0, 1.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
149 call assert_equal('nan', string(atan2(0.0/0.0, 1.0)))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
150 call assert_fails('call atan2("", -1)', 'E808:')
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
151 call assert_fails('call atan2(-1, "")', 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 func Test_tanh()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
155 call assert_equal('0.0', string(tanh(0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
156 call assert_equal('0.462117', string(tanh(0.5)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
157 call assert_equal('-0.761594', string(tanh(-1.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
158 call assert_equal('1.0', string(tanh(1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
159 call assert_equal('-1.0', string(tanh(-1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
160 call assert_equal('nan', string(tanh(0.0/0.0)))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
161 call assert_fails('call tanh("")', 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 func Test_fmod()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
165 call assert_equal('0.13', string(fmod(12.33, 1.22)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
166 call assert_equal('-0.13', string(fmod(-12.33, 1.22)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
167 call assert_equal('nan', string(fmod(1.0/0.0, 1.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
168 " On Windows we get "nan" instead of 1.0, accept both.
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
169 let res = string(fmod(1.0, 1.0/0.0))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
170 if res != 'nan'
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
171 call assert_equal('1.0', res)
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
172 endif
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
173 call assert_equal('nan', string(fmod(1.0, 0.0)))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
174 call assert_fails("call fmod('', 1.22)", 'E808:')
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
175 call assert_fails("call fmod(12.33, '')", 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 func Test_pow()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
179 call assert_equal('1.0', string(pow(0.0, 0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
180 call assert_equal('8.0', string(pow(2.0, 3.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
181 call assert_equal('nan', string(pow(2.0, 0.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
182 call assert_equal('nan', string(pow(0.0/0.0, 3.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
183 call assert_equal('nan', string(pow(0.0/0.0, 3.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
184 call assert_equal('inf', string(pow(2.0, 1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
185 call assert_equal('inf', string(pow(1.0/0.0, 3.0)))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
186 call assert_fails("call pow('', 2.0)", 'E808:')
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
187 call assert_fails("call pow(2.0, '')", 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 func Test_str2float()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
191 call assert_equal('1.0', string(str2float('1')))
10555
fff45421182b patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents: 10536
diff changeset
192 call assert_equal('1.0', string(str2float(' 1 ')))
fff45421182b patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents: 10536
diff changeset
193 call assert_equal('1.0', string(str2float(' 1.0 ')))
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
194 call assert_equal('1.23', string(str2float('1.23')))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
195 call assert_equal('1.23', string(str2float('1.23abc')))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
196 call assert_equal('1.0e40', string(str2float('1e40')))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
197 call assert_equal('-1.23', string(str2float('-1.23')))
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
198 call assert_equal('1.23', string(str2float(' + 1.23 ')))
10555
fff45421182b patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents: 10536
diff changeset
199
fff45421182b patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents: 10536
diff changeset
200 call assert_equal('1.0', string(str2float('+1')))
fff45421182b patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents: 10536
diff changeset
201 call assert_equal('1.0', string(str2float('+1')))
fff45421182b patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents: 10536
diff changeset
202 call assert_equal('1.0', string(str2float(' +1 ')))
fff45421182b patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents: 10536
diff changeset
203 call assert_equal('1.0', string(str2float(' + 1 ')))
fff45421182b patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents: 10536
diff changeset
204
fff45421182b patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents: 10536
diff changeset
205 call assert_equal('-1.0', string(str2float('-1')))
fff45421182b patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents: 10536
diff changeset
206 call assert_equal('-1.0', string(str2float('-1')))
fff45421182b patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents: 10536
diff changeset
207 call assert_equal('-1.0', string(str2float(' -1 ')))
fff45421182b patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents: 10536
diff changeset
208 call assert_equal('-1.0', string(str2float(' - 1 ')))
fff45421182b patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents: 10536
diff changeset
209
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
210 call assert_equal('0.0', string(str2float('+0.0')))
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
211 call assert_equal('-0.0', string(str2float('-0.0')))
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
212 call assert_equal('inf', string(str2float('1e1000')))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
213 call assert_equal('inf', string(str2float('inf')))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
214 call assert_equal('-inf', string(str2float('-inf')))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
215 call assert_equal('inf', string(str2float('+inf')))
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
216 call assert_equal('inf', string(str2float('Inf')))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
217 call assert_equal('inf', string(str2float(' +inf ')))
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
218 call assert_equal('nan', string(str2float('nan')))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
219 call assert_equal('nan', string(str2float('NaN')))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
220 call assert_equal('nan', string(str2float(' nan ')))
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
221
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
222 call assert_fails("call str2float(1.2)", 'E806:')
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
223 call assert_fails("call str2float([])", 'E730:')
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
224 call assert_fails("call str2float({})", 'E731:')
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
225 call assert_fails("call str2float(function('string'))", 'E729:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227
11461
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
228 func Test_float2nr()
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
229 call assert_equal(1, float2nr(1.234))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
230 call assert_equal(123, float2nr(1.234e2))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
231 call assert_equal(12, float2nr(123.4e-1))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
232 let max_number = 1/0
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
233 let min_number = -max_number
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
234 call assert_equal(max_number/2+1, float2nr(pow(2, 62)))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
235 call assert_equal(max_number, float2nr(pow(2, 63)))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
236 call assert_equal(max_number, float2nr(pow(2, 64)))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
237 call assert_equal(min_number/2-1, float2nr(-pow(2, 62)))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
238 call assert_equal(min_number, float2nr(-pow(2, 63)))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
239 call assert_equal(min_number, float2nr(-pow(2, 64)))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
240 endfunc
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
241
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
242 func Test_floor()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
243 call assert_equal('2.0', string(floor(2.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
244 call assert_equal('2.0', string(floor(2.11)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
245 call assert_equal('2.0', string(floor(2.99)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
246 call assert_equal('-3.0', string(floor(-2.11)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
247 call assert_equal('-3.0', string(floor(-2.99)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
248 call assert_equal('nan', string(floor(0.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
249 call assert_equal('inf', string(floor(1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
250 call assert_equal('-inf', string(floor(-1.0/0.0)))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
251 call assert_fails("call floor('')", 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
252 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
253
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
254 func Test_ceil()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
255 call assert_equal('2.0', string(ceil(2.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
256 call assert_equal('3.0', string(ceil(2.11)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
257 call assert_equal('3.0', string(ceil(2.99)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
258 call assert_equal('-2.0', string(ceil(-2.11)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
259 call assert_equal('-2.0', string(ceil(-2.99)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
260 call assert_equal('nan', string(ceil(0.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
261 call assert_equal('inf', string(ceil(1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
262 call assert_equal('-inf', string(ceil(-1.0/0.0)))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
263 call assert_fails("call ceil('')", 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
264 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
265
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
266 func Test_round()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
267 call assert_equal('2.0', string(round(2.1)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
268 call assert_equal('3.0', string(round(2.5)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
269 call assert_equal('3.0', string(round(2.9)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
270 call assert_equal('-2.0', string(round(-2.1)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
271 call assert_equal('-3.0', string(round(-2.5)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
272 call assert_equal('-3.0', string(round(-2.9)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
273 call assert_equal('nan', string(round(0.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
274 call assert_equal('inf', string(round(1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
275 call assert_equal('-inf', string(round(-1.0/0.0)))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
276 call assert_fails("call round('')", 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
277 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
278
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
279 func Test_trunc()
10536
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
280 call assert_equal('2.0', string(trunc(2.1)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
281 call assert_equal('2.0', string(trunc(2.5)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
282 call assert_equal('2.0', string(trunc(2.9)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
283 call assert_equal('-2.0', string(trunc(-2.1)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
284 call assert_equal('-2.0', string(trunc(-2.5)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
285 call assert_equal('-2.0', string(trunc(-2.9)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
286 call assert_equal('nan', string(trunc(0.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
287 call assert_equal('inf', string(trunc(1.0/0.0)))
6ddf322ff7cf patch 8.0.0158: float funcion test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10532
diff changeset
288 call assert_equal('-inf', string(trunc(-1.0/0.0)))
10557
018b7ecc58db patch 8.0.0168: not all float functionality is tested
Christian Brabandt <cb@256bit.org>
parents: 10555
diff changeset
289 call assert_fails("call trunc('')", 'E808:')
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
290 endfunc
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
291
16213
2c33b119ba92 patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents: 11461
diff changeset
292 func Test_isinf()
2c33b119ba92 patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents: 11461
diff changeset
293 call assert_equal(1, isinf(1.0/0.0))
2c33b119ba92 patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents: 11461
diff changeset
294 call assert_equal(-1, isinf(-1.0/0.0))
2c33b119ba92 patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents: 11461
diff changeset
295 call assert_false(isinf(1.0))
2c33b119ba92 patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents: 11461
diff changeset
296 call assert_false(isinf(0.0/0.0))
2c33b119ba92 patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents: 11461
diff changeset
297 call assert_false(isinf('a'))
2c33b119ba92 patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents: 11461
diff changeset
298 call assert_false(isinf([]))
2c33b119ba92 patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents: 11461
diff changeset
299 call assert_false(isinf({}))
2c33b119ba92 patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents: 11461
diff changeset
300 endfunc
2c33b119ba92 patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents: 11461
diff changeset
301
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
302 func Test_isnan()
16213
2c33b119ba92 patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents: 11461
diff changeset
303 call assert_true(isnan(0.0/0.0))
2c33b119ba92 patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents: 11461
diff changeset
304 call assert_false(isnan(1.0))
2c33b119ba92 patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents: 11461
diff changeset
305 call assert_false(isnan(1.0/0.0))
2c33b119ba92 patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents: 11461
diff changeset
306 call assert_false(isnan(-1.0/0.0))
2c33b119ba92 patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents: 11461
diff changeset
307 call assert_false(isnan('a'))
2c33b119ba92 patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents: 11461
diff changeset
308 call assert_false(isnan([]))
2c33b119ba92 patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents: 11461
diff changeset
309 call assert_false(isnan({}))
10532
80b50e43e382 commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
310 endfunc
11461
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
311
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
312 " This was converted from test65
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
313 func Test_float_misc()
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
314 call assert_equal('123.456000', printf('%f', 123.456))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
315 call assert_equal('1.234560e+02', printf('%e', 123.456))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
316 call assert_equal('123.456', printf('%g', 123.456))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
317 " +=
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
318 let v = 1.234
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
319 let v += 6.543
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
320 call assert_equal('7.777', printf('%g', v))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
321 let v = 1.234
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
322 let v += 5
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
323 call assert_equal('6.234', printf('%g', v))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
324 let v = 5
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
325 let v += 3.333
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
326 call assert_equal('8.333', string(v))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
327 " ==
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
328 let v = 1.234
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
329 call assert_true(v == 1.234)
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
330 call assert_false(v == 1.2341)
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
331 " add-subtract
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
332 call assert_equal('5.234', printf('%g', 4 + 1.234))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
333 call assert_equal('-6.766', printf('%g', 1.234 - 8))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
334 " mult-div
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
335 call assert_equal('4.936', printf('%g', 4 * 1.234))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
336 call assert_equal('0.003241', printf('%g', 4.0 / 1234))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
337 " dict
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
338 call assert_equal("{'x': 1.234, 'y': -2.0e20}", string({'x': 1.234, 'y': -2.0e20}))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
339 " list
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
340 call assert_equal('[-123.4, 2.0e-20]', string([-123.4, 2.0e-20]))
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
341 endfunc
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
342
5be73ebf6a15 patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents: 10557
diff changeset
343 " vim: shiftwidth=2 sts=2 expandtab