Mercurial > vim
annotate src/testdir/test_float_func.vim @ 10532:80b50e43e382 v8.0.0156
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 8 17:59:14 2017 +0100
patch 8.0.0156: not enough test coverage for float functions
Problem: Several float functions are not covered by tests.
Solution: Add float tests. (Dominique Pelle)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 08 Jan 2017 18:00:05 +0100 |
parents | |
children | 6ddf322ff7cf |
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() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 call assert_equal(string(abs(1.23)), '1.23') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 call assert_equal(string(abs(-1.23)), '1.23') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 call assert_equal(string(abs(0.0)), '0.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 call assert_equal(string(abs(1.0/(1.0/0.0))), '0.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 call assert_equal(string(abs(-1.0/(1.0/0.0))), '0.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 call assert_equal(string(abs(1.0/0.0)), 'inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 call assert_equal(string(abs(-1.0/0.0)), 'inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 call assert_equal(string(abs(0.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 func Test_sqrt() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 call assert_equal(string(sqrt(0.0)), '0.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 call assert_equal(string(sqrt(2.0)), '1.414214') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 call assert_equal(string(sqrt(1.0/0.0)), 'inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call assert_equal(string(sqrt(-1.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 call assert_equal(string(sqrt(0.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 func Test_log() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 call assert_equal(string(log(1.0)), '0.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 call assert_equal(string(log(0.5)), '-0.693147') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 call assert_equal(string(log(0.0)), '-inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 call assert_equal(string(log(-1.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 call assert_equal(string(log(1.0/0.0)), 'inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 call assert_equal(string(log(0.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 func Test_log10() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 call assert_equal(string(log10(1.0)), '0.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 call assert_equal(string(log10(100.0)), '2.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 call assert_equal(string(log10(120.0)), '2.079181') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 call assert_equal(string(log10(0.0)), '-inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 call assert_equal(string(log10(-1.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 call assert_equal(string(log10(1.0/0.0)), 'inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 call assert_equal(string(log10(0.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 func Test_exp() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 call assert_equal(string(exp(0.0)), '1.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 call assert_equal(string(exp(2.0)), '7.389056') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 call assert_equal(string(exp(-1.0)),'0.367879') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 call assert_equal(string(exp(1.0/0.0)), 'inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 call assert_equal(string(exp(-1.0/0.0)), '0.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 call assert_equal(string(exp(0.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 func Test_sin() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 call assert_equal(string(sin(0.0)), '0.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 call assert_equal(string(sin(1.0)), '0.841471') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 call assert_equal(string(sin(-0.5)), '-0.479426') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 call assert_equal(string(sin(0.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 call assert_equal(string(sin(1.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 call assert_equal(string(sin(1.0/(1.0/0.0))), '0.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 call assert_equal(string(sin(-1.0/(1.0/0.0))), '-0.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 func Test_asin() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 call assert_equal(string(asin(0.0)), '0.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 call assert_equal(string(asin(1.0)), '1.570796') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 call assert_equal(string(asin(-0.5)), '-0.523599') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 call assert_equal(string(asin(1.1)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 call assert_equal(string(asin(1.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 call assert_equal(string(asin(0.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 func Test_sinh() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 call assert_equal(string(sinh(0.0)), '0.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 call assert_equal(string(sinh(0.5)), '0.521095') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 call assert_equal(string(sinh(-0.9)), '-1.026517') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 call assert_equal(string(sinh(1.0/0.0)), 'inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 call assert_equal(string(sinh(-1.0/0.0)), '-inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 call assert_equal(string(sinh(0.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 func Test_cos() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 call assert_equal(string(cos(0.0)), '1.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 call assert_equal(string(cos(1.0)), '0.540302') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 call assert_equal(string(cos(-0.5)), '0.877583') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 call assert_equal(string(cos(0.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 call assert_equal(string(cos(1.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 func Test_acos() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 call assert_equal(string(acos(0.0)), '1.570796') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 call assert_equal(string(acos(1.0)), '0.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 call assert_equal(string(acos(-1.0)), '3.141593') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 call assert_equal(string(acos(-0.5)), '2.094395') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 call assert_equal(string(acos(1.1)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 call assert_equal(string(acos(1.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 call assert_equal(string(acos(0.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 func Test_cosh() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 call assert_equal(string(cosh(0.0)), '1.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
102 call assert_equal(string(cosh(0.5)), '1.127626') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 call assert_equal(string(cosh(1.0/0.0)), 'inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
104 call assert_equal(string(cosh(-1.0/0.0)), 'inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
105 call assert_equal(string(cosh(0.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 func Test_tan() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
109 call assert_equal(string(tan(0.0)), '0.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
110 call assert_equal(string(tan(0.5)), '0.546302') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 call assert_equal(string(tan(-0.5)), '-0.546302') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
112 call assert_equal(string(tan(1.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
113 call assert_equal(string(cos(0.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
114 call assert_equal(string(tan(1.0/(1.0/0.0))), '0.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
115 call assert_equal(string(tan(-1.0/(1.0/0.0))), '-0.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
116 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
117 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
118 func Test_atan() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
119 call assert_equal(string(atan(0.0)), '0.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
120 call assert_equal(string(atan(0.5)), '0.463648') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
121 call assert_equal(string(atan(-1.0)), '-0.785398') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
122 call assert_equal(string(atan(1.0/0.0)), '1.570796') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
123 call assert_equal(string(atan(-1.0/0.0)), '-1.570796') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
124 call assert_equal(string(atan(0.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
125 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
126 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
127 func Test_atan2() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
128 call assert_equal(string(atan2(-1, -1)), '-2.356194') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
129 call assert_equal(string(atan2(1, -1)), '2.356194') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 call assert_equal(string(atan2(1.0, 1.0/0.0)), '0.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 call assert_equal(string(atan2(1.0/0.0, 1.0)), '1.570796') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
132 call assert_equal(string(atan2(0.0/0.0, 1.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
133 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
134 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
135 func Test_tanh() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
136 call assert_equal(string(tanh(0.0)), '0.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
137 call assert_equal(string(tanh(0.5)), '0.462117') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
138 call assert_equal(string(tanh(-1.0)), '-0.761594') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
139 call assert_equal(string(tanh(1.0/0.0)), '1.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
140 call assert_equal(string(tanh(-1.0/0.0)), '-1.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
141 call assert_equal(string(tanh(0.0/0.0)), 'nan') |
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_fmod() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
145 call assert_equal(string(fmod(12.33, 1.22)), '0.13') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
146 call assert_equal(string(fmod(-12.33, 1.22)), '-0.13') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
147 call assert_equal(string(fmod(1.0/0.0, 1.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
148 call assert_equal(string(fmod(1.0, 1.0/0.0)), '1.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
149 call assert_equal(string(fmod(1.0, 0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
150 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
151 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
152 func Test_pow() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
153 call assert_equal(string(pow(0.0, 0.0)), '1.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
154 call assert_equal(string(pow(2.0, 3.0)), '8.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
155 call assert_equal(string(pow(2.0, 0.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
156 call assert_equal(string(pow(0.0/0.0, 3.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
157 call assert_equal(string(pow(0.0/0.0, 3.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
158 call assert_equal(string(pow(2.0, 1.0/0.0)), 'inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
159 call assert_equal(string(pow(1.0/0.0, 3.0)), 'inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
160 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
161 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
162 func Test_str2float() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
163 call assert_equal(string(str2float('1')), '1.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
164 call assert_equal(string(str2float('1.23')), '1.23') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
165 call assert_equal(string(str2float('1.23abc')), '1.23') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
166 call assert_equal(string(str2float('1e40')), '1.0e40') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 call assert_equal(string(str2float('1e1000')), 'inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 call assert_equal(string(str2float('inf')), 'inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
169 call assert_equal(string(str2float('-inf')), '-inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
170 call assert_equal(string(str2float('Inf')), 'inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
171 call assert_equal(string(str2float('nan')), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
172 call assert_equal(string(str2float('NaN')), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
173 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
174 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
175 func Test_floor() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
176 call assert_equal(string(floor(2.0)), '2.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 call assert_equal(string(floor(2.11)), '2.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
178 call assert_equal(string(floor(2.99)), '2.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
179 call assert_equal(string(floor(-2.11)), '-3.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
180 call assert_equal(string(floor(-2.99)), '-3.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
181 call assert_equal(string(floor(0.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
182 call assert_equal(string(floor(1.0/0.0)), 'inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 call assert_equal(string(floor(-1.0/0.0)), '-inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
186 func Test_ceil() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
187 call assert_equal(string(ceil(2.0)), '2.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
188 call assert_equal(string(ceil(2.11)), '3.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
189 call assert_equal(string(ceil(2.99)), '3.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
190 call assert_equal(string(ceil(-2.11)), '-2.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 call assert_equal(string(ceil(-2.99)), '-2.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
192 call assert_equal(string(ceil(0.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
193 call assert_equal(string(ceil(1.0/0.0)), 'inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
194 call assert_equal(string(ceil(-1.0/0.0)), '-inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
195 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
196 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
197 func Test_round() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
198 call assert_equal(string(round(2.1)), '2.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
199 call assert_equal(string(round(2.5)), '3.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
200 call assert_equal(string(round(2.9)), '3.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
201 call assert_equal(string(round(-2.1)), '-2.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
202 call assert_equal(string(round(-2.5)), '-3.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
203 call assert_equal(string(round(-2.9)), '-3.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
204 call assert_equal(string(round(0.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
205 call assert_equal(string(round(1.0/0.0)), 'inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
206 call assert_equal(string(round(-1.0/0.0)), '-inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
207 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
208 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
209 func Test_trunc() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
210 call assert_equal(string(trunc(2.1)), '2.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
211 call assert_equal(string(trunc(2.5)), '2.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
212 call assert_equal(string(trunc(2.9)), '2.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
213 call assert_equal(string(trunc(-2.1)), '-2.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
214 call assert_equal(string(trunc(-2.5)), '-2.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
215 call assert_equal(string(trunc(-2.9)), '-2.0') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
216 call assert_equal(string(trunc(0.0/0.0)), 'nan') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
217 call assert_equal(string(trunc(1.0/0.0)), 'inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
218 call assert_equal(string(trunc(-1.0/0.0)), '-inf') |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
219 endfunc |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
220 |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
221 func Test_isnan() |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
222 call assert_equal(isnan(1.0), 0) |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
223 call assert_equal(isnan(0.0/0.0), 1) |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
224 call assert_equal(isnan(1.0/0.0), 0) |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
225 call assert_equal(isnan('a'), 0) |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
226 call assert_equal(isnan([]), 0) |
80b50e43e382
commit https://github.com/vim/vim/commit/453b576ee5d32e9b8e6876712748ae01f9be68dd
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
227 endfunc |