@@ -56,20 +56,20 @@ do -- abs
5656end
5757
5858do -- acos
59- matches (math.acos (0.5 ), ' ^1% .047' , " function acos" )
59+ near (math.acos (0.5 ), 1 .047, 0.001 , " function acos" )
6060end
6161
6262do -- asin
63- matches (math.asin (0.5 ), ' ^0% .523' , " function asin" )
63+ near (math.asin (0.5 ), 0 .523, 0.001 , " function asin" )
6464end
6565
6666do -- atan
67- matches (math.atan (0.5 ), ' ^0% .463' , " function atan" )
67+ near (math.atan (0.5 ), 0 .463, 0.001 , " function atan" )
6868end
6969
7070-- atan2
7171if has_mathx then
72- matches (math.atan2 (1.0 , 2.0 ), ' ^0% .463' , " function atan2" )
72+ near (math.atan2 (1.0 , 2.0 ), 0 .463, 0.001 , " function atan2" )
7373else
7474 is_nil (math.atan2 , " function atan2 (removed)" )
7575end
@@ -84,12 +84,12 @@ do -- ceil
8484end
8585
8686do -- cos
87- matches (math.cos (1.0 ), ' ^0% .540' , " function cos" )
87+ near (math.cos (1.0 ), 0 .540, 0.001 , " function cos" )
8888end
8989
9090-- cosh
9191if has_mathx then
92- matches (math.cosh (1.0 ), ' ^1% .543' , " function cosh" )
92+ near (math.cosh (1.0 ), 1 .543, 0.001 , " function cosh" )
9393else
9494 is_nil (math.cosh , " function cosh (removed)" )
9595end
@@ -99,7 +99,7 @@ do -- deg
9999end
100100
101101do -- exp
102- matches (math.exp (1.0 ), ' ^2% .718' , " function exp" )
102+ near (math.exp (1.0 ), 2 .718, 0.001 , " function exp" )
103103end
104104
105105do -- floor
@@ -112,9 +112,9 @@ do -- floor
112112end
113113
114114do -- fmod
115- matches (math.fmod (7.0001 , 0.3 ), ' ^0% .100' , " function fmod (float)" )
116- matches (math.fmod (- 7.0001 , 0.3 ), ' ^-0% .100' )
117- matches (math.fmod (- 7.0001 , - 0.3 ), ' ^-0% .100' )
115+ near (math.fmod (7.0001 , 0.3 ), 0 .100, 0.001 , " function fmod (float)" )
116+ near (math.fmod (- 7.0001 , 0.3 ), - 0 .100, 0.001 )
117+ near (math.fmod (- 7.0001 , - 0.3 ), - 0 .100, 0.001 )
118118 if math.type then
119119 equals (math.type (math.fmod (7.0 , 0.3 )), ' float' )
120120 end
@@ -155,17 +155,17 @@ else
155155end
156156
157157do -- log
158- matches (math.log (47 ), ' ^3% .85' , " function log" )
158+ near (math.log (47 ), 3 .85, 0.01 , " function log" )
159159 if has_log_with_base then
160- matches (math.log (47 , math.exp (1 )), ' ^3% .85' , " function log (base e)" )
161- matches (math.log (47 , 2 ), ' ^5% .554' , " function log (base 2)" )
162- matches (math.log (47 , 10 ), ' ^1% .672' , " function log (base 10)" )
160+ near (math.log (47 , math.exp (1 )), 3 .85, 0.01 , " function log (base e)" )
161+ near (math.log (47 , 2 ), 5 .554, 0.001 , " function log (base 2)" )
162+ near (math.log (47 , 10 ), 1 .672, 0.001 , " function log (base 10)" )
163163 end
164164end
165165
166166-- log10
167167if has_log10 then
168- matches (math.log10 (47.0 ), ' ^1% .672' , " function log10" )
168+ near (math.log10 (47.0 ), 1 .672, 0.001 , " function log10" )
169169else
170170 is_nil (math.log10 , " function log10 (removed)" )
171171end
@@ -223,7 +223,7 @@ do -- modf
223223end
224224
225225do -- pi
226- matches ( tostring ( math.pi ), ' ^3% .14' , " variable pi" )
226+ near ( math.pi , 3 .14, 0.01 , " variable pi" )
227227end
228228
229229-- pow
234234end
235235
236236do -- rad
237- matches (math.rad (180 ), ' ^3% .14' , " function rad" )
237+ near (math.rad (180 ), 3 .14, 0.01 , " function rad" )
238238end
239239
240240do -- random
@@ -291,27 +291,27 @@ do -- randomseed
291291end
292292
293293do -- sin
294- matches (math.sin (1.0 ), ' ^0% .841' , " function sin" )
294+ near (math.sin (1.0 ), 0 .841, 0.001 , " function sin" )
295295end
296296
297297-- sinh
298298if has_mathx then
299- matches (math.sinh (1 ), ' ^1% .175' , " function sinh" )
299+ near (math.sinh (1 ), 1 .175, 0.001 , " function sinh" )
300300else
301301 is_nil (math.sinh , " function sinh (removed)" )
302302end
303303
304304do -- sqrt
305- matches (math.sqrt (2 ), ' ^1% .414' , " function sqrt" )
305+ near (math.sqrt (2 ), 1 .414, 0.001 , " function sqrt" )
306306end
307307
308308do -- tan
309- matches (math.tan (1.0 ), ' ^1% .557' , " function tan" )
309+ near (math.tan (1.0 ), 1 .557, 0.001 , " function tan" )
310310end
311311
312312-- tanh
313313if has_mathx then
314- matches (math.tanh (1 ), ' ^0% .761' , " function tanh" )
314+ near (math.tanh (1 ), 0 .761, 0.001 , " function tanh" )
315315else
316316 is_nil (math.tanh , " function tanh (removed)" )
317317end
0 commit comments