@@ -35,9 +35,9 @@ local function eq
3535(a,b,limit)
3636if not limit then
3737if floatbits >= 50 then
38−limit=1e-11.0
38+limit=1e-11
3939else
40−limit=1e-5.0
40+limit=1e-5
4141end
4242end
4343return a == b or math.abs(a - b) <= limit
@@ -67,10 +67,10 @@ local a,b = math.modf(3.5)
6767assert(a == 3.0 and b == 0.5)
6868a,b=math.modf(- 2.5)
6969assert(a == - 2.0 and b == - 0.5)
70−a,b=math.modf(- 3e23.0)
71−assert(a == - 3e23.0 and b == 0.0)
72−a,b=math.modf(3e35.0)
73−assert(a == 3e35.0 and b == 0.0)
70+a,b=math.modf(- 3e23)
71+assert(a == - 3e23 and b == 0.0)
72+a,b=math.modf(3e35)
73+assert(a == 3e35 and b == 0.0)
7474a,b=math.modf(- 1 / 0)
7575assert(a == - 1 / 0 and b == 0.0)
7676a,b=math.modf(1 / 0)
@@ -82,8 +82,8 @@ assert(eqT(a,3) and eqT(b,0.0))
8282a,b=math.modf(minint)
8383assert(eqT(a,minint) and eqT(b,0.0))
8484end
85−assert(math.huge > 1e31.0)
86−assert(- math.huge < - 1e31.0)
85+assert(math.huge > 1e31)
86+assert(- math.huge < - 1e31)
8787assert(minint < minint + 1)
8888assert(maxint - 1 < maxint)
8989assert(0 - minint == minint)
@@ -313,13 +313,13 @@ return s
313313end
314314assert(eqT(tonumber(incd(maxint)),maxint + 1.0))
315315assert(eqT(tonumber(incd(minint)),minint - 1.0))
316−assert(eqT(tonumber("\49" .. string.rep("\48",30)),1e30.0))
317−assert(eqT(tonumber("\45\49" .. string.rep("\48",30)),- 1e30.0))
316+assert(eqT(tonumber("\49" .. string.rep("\48",30)),1e30))
317+assert(eqT(tonumber("\45\49" .. string.rep("\48",30)),- 1e30))
318318assert(eqT(tonumber("\48\120\49" .. string.rep("\48",30)),0))
319319assert(minint == load("\114\101\116\117\114\110\32" .. minint)())
320320assert(eqT(maxint,load("\114\101\116\117\114\110\32" .. maxint)()))
321−assert(eqT(1e22.0,10000000000000000000000))
322−assert(eqT(- 1e22.0,- 10000000000000000000000))
321+assert(eqT(1e22,10000000000000000000000))
322+assert(eqT(- 1e22,- 10000000000000000000000))
323323end
324324assert(tonumber(3.4) == 3.4)
325325assert(eqT(tonumber(3),3))
@@ -432,7 +432,7 @@ assert(100.0 == 100.0 and 0.01 == 0.01)
432432assert(1111111111 - 1111111110 == 1.0)
433433assert(1.1 == "\49\46" + "\46\49")
434434assert(tonumber("\49\49\49\49\49\49\49\49\49\49") - tonumber("\49\49\49\49\49\49\49\49\49\48") == tonumber("\32\32\43\48\46\48\48\49\101\43\51\32\10\9"))
435−assert(1e-31.0 > 9e-32.0 and 9e29.0 < 1e30.0)
435+assert(1e-31 > 9e-32 and 9e29 < 1e30)
436436assert(0.123456 > 0.123455)
437437assert(tonumber("\43\49\46\50\51\69\49\56") == 1.23 * 10.0 ^ 18)
438438assert(not (1 < 1) and (1 < 2) and not (2 < 1))
@@ -461,7 +461,7 @@ assert(eqT(10.0 % 2,0.0))
461461assert(eqT(- 10.0 % 2,0.0))
462462assert(eqT(- 10.0 % - 2,0.0))
463463assert(math.pi - math.pi % 1 == 3)
464−assert(math.pi - math.pi % 1e-3.0 == 3.141)
464+assert(math.pi - math.pi % 1e-3 == 3.141)
465465do
466466local i,j = 0,20000
467467while i < j do
@@ -526,12 +526,12 @@ end
526526anan(0.0 % 0)
527527anan(1.3 % 0)
528528anan(math.huge % 1)
529−anan(math.huge % 1e30.0)
530−anan(- math.huge % 1e30.0)
531−anan(- math.huge % - 1e30.0)
529+anan(math.huge % 1e30)
530+anan(- math.huge % 1e30)
531+anan(- math.huge % - 1e30)
532532assert(1 % math.huge == 1)
533−assert(1e30.0 % math.huge == 1e30.0)
534−assert(1e30.0 % - math.huge == - math.huge)
533+assert(1e30 % math.huge == 1e30)
534+assert(1e30 % - math.huge == - math.huge)
535535assert(- 1 % math.huge == math.huge)
536536assert(- 1 % - math.huge == - 1)
537537end
@@ -575,10 +575,10 @@ assert(eqT(math.floor(minint),minint))
575575assert(eqT(math.floor(minint + 0.0),minint))
576576assert(eqT(math.ceil(minint),minint))
577577assert(eqT(math.ceil(minint + 0.0),minint))
578−assert(math.floor(1e50.0) == 1e50.0)
579−assert(math.ceil(1e50.0) == 1e50.0)
580−assert(math.floor(- 1e50.0) == - 1e50.0)
581−assert(math.ceil(- 1e50.0) == - 1e50.0)
578+assert(math.floor(1e50) == 1e50)
579+assert(math.ceil(1e50) == 1e50)
580+assert(math.floor(- 1e50) == - 1e50)
581+assert(math.ceil(- 1e50) == - 1e50)
582582for _,p in pairs({31,32,63,64})
583583do
584584assert(math.floor(2 ^ p) == 2 ^ p)
@@ -632,13 +632,13 @@ checkerror("\118\97\108\117\101\32\101\120\112\101\99\116\101\100",math.max)
632632checkerror("\118\97\108\117\101\32\101\120\112\101\99\116\101\100",math.min)
633633assert(eqT(math.max(3),3))
634634assert(eqT(math.max(3,5,9,1),9))
635−assert(math.max(maxint,1e61.0) == 1e61.0)
635+assert(math.max(maxint,1e61) == 1e61)
636636assert(eqT(math.max(minint,minint + 1),minint + 1))
637637assert(eqT(math.min(3),3))
638638assert(eqT(math.min(3,5,9,1),1))
639639assert(math.min(3.2,5.9,- 9.2,1.1) == - 9.2)
640640assert(math.min(1.9,1.7,1.72) == 1.7)
641−assert(math.min(- 1e61.0,minint) == - 1e61.0)
641+assert(math.min(- 1e61,minint) == - 1e61)
642642assert(eqT(math.min(maxint,maxint - 1),maxint - 1))
643643assert(eqT(math.min(maxint - 2,maxint,maxint - 1),maxint - 2))
644644end
@@ -737,7 +737,7 @@ counts[bit + 1]=counts[bit + 1] + 1
737737end
738738end
739739totalrounds=totalrounds + rounds
740−if not (eq(up,1,1e-3.0) and eq(low,0,1e-3.0)) then
740+if not (eq(up,1,1e-3) and eq(low,0,1e-3)) then
741741goto doagain
742742end
743743local expected = (totalrounds / randbits / 2)
@@ -780,7 +780,7 @@ if not testnear(counts[i],expected,0.1) then
780780goto doagain
781781end
782782end
783−print(string.format("\105\110\116\101\103\101\114\32\114\97\110\100\111\109\32\114\97\110\103\101\32\105\110\32\37\100\32\99\97\108\108\115\58\32\91\109\105\110\105\110\116\32\43\32\37\46\48\102\112\112\109\44\32\109\97\120\105\110\116\32\45\32\37\46\48\102\112\112\109\93",totalrounds,(minint - low) / minint * 1e6.0,(maxint - up) / maxint * 1e6.0))
783+print(string.format("\105\110\116\101\103\101\114\32\114\97\110\100\111\109\32\114\97\110\103\101\32\105\110\32\37\100\32\99\97\108\108\115\58\32\91\109\105\110\105\110\116\32\43\32\37\46\48\102\112\112\109\44\32\109\97\120\105\110\116\32\45\32\37\46\48\102\112\112\109\93",totalrounds,(minint - low) / minint * 1e6,(maxint - up) / maxint * 1e6))
784784end
785785do
786786local count = {0,0,0,0,0,0}