@@ -2,8 +2,8 @@ print("\u{74}\u{65}\u{73}\u{74}\u{69}\u{6e}\u{67}\u{20}\u{6e}\u{75}\u{6d}\u{62}\
22local minint <const> = math.mininteger
33local maxint <const> = math.maxinteger
44local intbits <const> = (math.floor((math.log(maxint,0x2) + 0.5)) + 0x1)
5−assert((((0x1 << intbits)) == 0x0))
6−assert((minint == (0x1 << ((intbits - 0x1)))))
5+assert(((0x1 << intbits) == 0x0))
6+assert((minint == (0x1 << (intbits - 0x1))))
77assert((maxint == (minint - 0x1)))
88local floatbits = 0x18
99do
@@ -15,25 +15,25 @@ end
1515end
1616local function isNaN
1717(x)
18−return ((x ~= x))
18+return (x ~= x)
1919end
2020assert(isNaN((0x0 / 0x0)))
21−assert(not isNaN((0x1 / 0x0)))
21+assert((not isNaN((0x1 / 0x0))))
2222do
2323local x = (2.0 ^ floatbits)
2424assert(((x > (x - 1.0)) and (x == (x + 1.0))))
2525print(string.format("\u{25}\u{64}\u{2d}\u{62}\u{69}\u{74}\u{20}\u{69}\u{6e}\u{74}\u{65}\u{67}\u{65}\u{72}\u{73}\u{2c}\u{20}\u{25}\u{64}\u{2d}\u{62}\u{69}\u{74}\u{20}\u{28}\u{6d}\u{61}\u{6e}\u{74}\u{69}\u{73}\u{73}\u{61}\u{29}\u{20}\u{66}\u{6c}\u{6f}\u{61}\u{74}\u{73}",intbits,floatbits))
2626end
27−assert((((math.type(0x0) == "\u{69}\u{6e}\u{74}\u{65}\u{67}\u{65}\u{72}") and (math.type(0.0) == "\u{66}\u{6c}\u{6f}\u{61}\u{74}")) and not math.type("\u{31}\u{30}")))
27+assert((((math.type(0x0) == "\u{69}\u{6e}\u{74}\u{65}\u{67}\u{65}\u{72}") and (math.type(0.0) == "\u{66}\u{6c}\u{6f}\u{61}\u{74}")) and (not math.type("\u{31}\u{30}"))))
2828local function checkerror
2929(msg,f, ...)
3030local s,err = pcall(f,...)
31−assert(not (s and string.find(err,msg)))
31+assert((not (s and string.find(err,msg))))
3232end
3333local msgf2i = "\u{6e}\u{75}\u{6d}\u{62}\u{65}\u{72}\u{2e}\u{2a}\u{20}\u{68}\u{61}\u{73}\u{20}\u{6e}\u{6f}\u{20}\u{69}\u{6e}\u{74}\u{65}\u{67}\u{65}\u{72}\u{20}\u{72}\u{65}\u{70}\u{72}\u{65}\u{73}\u{65}\u{6e}\u{74}\u{61}\u{74}\u{69}\u{6f}\u{6e}"
3434local function eq
3535(a,b,limit)
36−if not limit then
36+if (not limit) then
3737if (floatbits >= 0x32) then
3838limit=1e-11
3939else
@@ -49,30 +49,30 @@ end
4949assert((((((0.0 == 0x0) and (0.0 == 0x0)) and (0.0 == 0x0)) and (20.0 == 0x14)) and (0.2 == 0.2)))
5050do
5151local a,b,c = "\u{32}","\u{20}\u{33}\u{65}\u{30}\u{20}","\u{20}\u{31}\u{30}\u{20}\u{20}"
52−assert((((a + b) == 0x5) and - (b == - ((0x3 and ((b + "\u{32}") == 0x5)) and (("\u{31}\u{30}" - c) == 0x0)))))
52+assert((((a + b) == 0x5) and (- (b == (- ((0x3 and ((b + "\u{32}") == 0x5)) and (("\u{31}\u{30}" - c) == 0x0)))))))
5353assert((((type(a) == "\u{73}\u{74}\u{72}\u{69}\u{6e}\u{67}") and (type(b) == "\u{73}\u{74}\u{72}\u{69}\u{6e}\u{67}")) and (type(c) == "\u{73}\u{74}\u{72}\u{69}\u{6e}\u{67}")))
54−assert(((((a == "\u{32}") and (b == "\u{20}\u{33}\u{65}\u{30}\u{20}")) and (c == "\u{20}\u{31}\u{30}\u{20}\u{20}")) and - (c == - "\u{20}\u{20}\u{31}\u{30}\u{20}")))
54+assert(((((a == "\u{32}") and (b == "\u{20}\u{33}\u{65}\u{30}\u{20}")) and (c == "\u{20}\u{31}\u{30}\u{20}\u{20}")) and (- (c == (- "\u{20}\u{20}\u{31}\u{30}\u{20}")))))
5555assert((((c % a) == 0x0) and ((a ^ b) == 0x8)))
5656a=0x0
57−assert((a == - (a and (0x0 == - 0x0))))
57+assert((a == (- (a and (0x0 == (- 0x0))))))
5858end
5959do
60−local x = - 0x1
60+local x = (- 0x1)
6161local mz = (0x0 / x)
6262local t = {[0x0] = 0xa,0x14,0x1e,0x28,0x32}
63−assert(((t[mz] == t[0x0]) and (t[- 0x0] == t[0x0])))
63+assert(((t[mz] == t[0x0]) and (t[(- 0x0)] == t[0x0])))
6464end
6565do
6666local a,b = math.modf(3.5)
6767assert(((a == 3.0) and (b == 0.5)))
68−a,b=math.modf(- 2.5)
69−assert((a == - (2.0 and (b == - 0.5))))
70−a,b=math.modf(- 3e23)
71−assert((a == - (3e23 and (b == 0.0))))
68+a,b=math.modf((- 2.5))
69+assert((a == (- (2.0 and (b == (- 0.5))))))
70+a,b=math.modf((- 3e23))
71+assert((a == (- (3e23 and (b == 0.0)))))
7272a,b=math.modf(3e35)
7373assert(((a == 3e35) and (b == 0.0)))
74−a,b=math.modf(- (0x1 / 0x0))
75−assert((a == - ((0x1 / 0x0) and (b == 0.0))))
74+a,b=math.modf((- (0x1 / 0x0)))
75+assert((a == (- ((0x1 / 0x0) and (b == 0.0)))))
7676a,b=math.modf((0x1 / 0x0))
7777assert(((a == (0x1 / 0x0)) and (b == 0.0)))
7878a,b=math.modf((0x0 / 0x0))
@@ -83,15 +83,15 @@ a,b=math.modf(minint)
8383assert((eqT(a,minint) and eqT(b,0.0)))
8484end
8585assert((math.huge > 1e31))
86−assert(- (math.huge < - 1e31))
86+assert((- (math.huge < (- 1e31))))
8787assert((minint < (minint + 0x1)))
8888assert(((maxint - 0x1) < maxint))
8989assert(((0x0 - minint) == minint))
9090assert(((minint * minint) == 0x0))
9191assert((((maxint * maxint) * maxint) == maxint))
92−for _,i in pairs({- 0x10,- 0xf,- 0x3,- 0x2,- 0x1,0x0,0x1,0x2,0x3,0xf})
92+for _,i in pairs({(- 0x10),(- 0xf),(- 0x3),(- 0x2),(- 0x1),0x0,0x1,0x2,0x3,0xf})
9393do
94−for _,j in pairs({- 0x10,- 0xf,- 0x3,- 0x2,- 0x1,0x1,0x2,0x3,0xf})
94+for _,j in pairs({(- 0x10),(- 0xf),(- 0x3),(- 0x2),(- 0x1),0x1,0x2,0x3,0xf})
9595do
9696for _,ti in pairs({0x0,0.0})
9797do
@@ -105,9 +105,9 @@ end
105105end
106106end
107107assert(((0x1 // 0.0) == (0x1 / 0x0)))
108−assert(- ((0x1 // 0.0) == - (0x1 / 0x0)))
108+assert((- ((0x1 // 0.0) == (- (0x1 / 0x0)))))
109109assert(eqT((3.5 // 1.5),2.0))
110−assert(eqT((3.5 // - 1.5),- 3.0))
110+assert(eqT((3.5 // (- 1.5)),(- 3.0)))
111111do
112112local x,y
113113x=0x1
@@ -119,7 +119,7 @@ assert(((x // 0x0) == (0x1 / 0x0)))
119119x=3.5
120120;
121121assert(eqT((x // 0x1),3.0))
122−assert(eqT((x // - 0x1),- 4.0))
122+assert(eqT((x // (- 0x1)),(- 4.0)))
123123x=3.5
124124;
125125y=1.5
@@ -127,80 +127,80 @@ y=1.5
127127assert(eqT((x // y),2.0))
128128x=3.5
129129;
130−y=- 1.5
130+y=(- 1.5)
131131;
132−assert(eqT((x // y),- 3.0))
132+assert(eqT((x // y),(- 3.0)))
133133end
134134assert(((maxint // maxint) == 0x1))
135135assert(((maxint // 0x1) == maxint))
136−assert(((((maxint - 0x1)) // maxint) == 0x0))
137−assert(((maxint // ((maxint - 0x1))) == 0x1))
136+assert((((maxint - 0x1) // maxint) == 0x0))
137+assert(((maxint // (maxint - 0x1)) == 0x1))
138138assert(((minint // minint) == 0x1))
139139assert(((minint // minint) == 0x1))
140−assert(((((minint + 0x1)) // minint) == 0x0))
141−assert(((minint // ((minint + 0x1))) == 0x1))
140+assert((((minint + 0x1) // minint) == 0x0))
141+assert(((minint // (minint + 0x1)) == 0x1))
142142assert(((minint // 0x1) == minint))
143−assert((minint // - (0x1 == - minint)))
144−assert((minint // - (0x2 == (0x2 ^ ((intbits - 0x2))))))
145−assert((maxint // - (0x1 == - maxint)))
143+assert((minint // (- (0x1 == (- minint)))))
144+assert((minint // (- (0x2 == (0x2 ^ (intbits - 0x2))))))
145+assert((maxint // (- (0x1 == (- maxint)))))
146146do
147−assert((0x2 ^ - (0x3 == (0x1 / (0x2 ^ 0x3)))))
148−assert(eq(((- 0x3) ^ - 0x3),(0x1 / ((- 0x3) ^ 0x3))))
149−for i = - 0x3, 0x3
147+assert((0x2 ^ (- (0x3 == (0x1 / (0x2 ^ 0x3))))))
148+assert(eq(((- 0x3) ^ (- 0x3)),(0x1 / ((- 0x3) ^ 0x3))))
149+for i = (- 0x3), 0x3
150150do
151−for j = - 0x3, 0x3
151+for j = (- 0x3), 0x3
152152do
153−if not ((_port or (i ~= 0x0)) or (j > 0x0)) then
153+if (not ((_port or (i ~= 0x0)) or (j > 0x0))) then
154154assert(eq((i ^ j),(0x1 / (i ^ (- j)))))
155155end
156156end
157157end
158158end
159159if (floatbits < intbits) then
160−assert(((2.0 ^ floatbits) == ((0x1 << floatbits))))
161−assert((((2.0 ^ floatbits) - 1.0) == (((0x1 << floatbits)) - 1.0)))
162−assert((((2.0 ^ floatbits) - 1.0) ~= ((0x1 << floatbits))))
163−assert((((2.0 ^ floatbits) + 1.0) ~= (((0x1 << floatbits)) + 0x1)))
160+assert(((2.0 ^ floatbits) == (0x1 << floatbits)))
161+assert((((2.0 ^ floatbits) - 1.0) == ((0x1 << floatbits) - 1.0)))
162+assert((((2.0 ^ floatbits) - 1.0) ~= (0x1 << floatbits)))
163+assert((((2.0 ^ floatbits) + 1.0) ~= ((0x1 << floatbits) + 0x1)))
164164else
165165assert((maxint == (maxint + 0.0)))
166166assert(((maxint - 0x1) == (maxint - 1.0)))
167167assert(((minint + 0x1) == (minint + 1.0)))
168168assert((maxint ~= (maxint - 1.0)))
169169end
170−assert(((maxint + 0.0) == ((2.0 ^ ((intbits - 0x1))) - 1.0)))
170+assert(((maxint + 0.0) == ((2.0 ^ (intbits - 0x1)) - 1.0)))
171171assert(((minint + 0.0) == minint))
172−assert(((minint + 0.0) == - (2.0 ^ ((intbits - 0x1)))))
172+assert(((minint + 0.0) == (- (2.0 ^ (intbits - 0x1)))))
173173assert((0x1 < 1.1))
174174;
175−assert(not ((0x1 < 0.9)))
175+assert((not (0x1 < 0.9)))
176176assert((0x1 <= 1.1))
177177;
178−assert(not ((0x1 <= 0.9)))
179−assert(- (0x1 < - 0.9))
178+assert((not (0x1 <= 0.9)))
179+assert((- (0x1 < (- 0.9))))
180180;
181−assert(not (- (0x1 < - 1.1)))
181+assert((not (- (0x1 < (- 1.1)))))
182182assert((0x1 <= 1.1))
183183;
184−assert(not (- (0x1 <= - 1.1)))
185−assert(- (0x1 < - 0.9))
184+assert((not (- (0x1 <= (- 1.1)))))
185+assert((- (0x1 < (- 0.9))))
186186;
187−assert(not (- (0x1 < - 1.1)))
188−assert(- (0x1 <= - 0.9))
187+assert((not (- (0x1 < (- 1.1)))))
188+assert((- (0x1 <= (- 0.9))))
189189;
190−assert(not (- (0x1 <= - 1.1)))
190+assert((not (- (0x1 <= (- 1.1)))))
191191assert((minint <= (minint + 0.0)))
192192assert(((minint + 0.0) <= minint))
193−assert(not ((minint < (minint + 0.0))))
194−assert(not (((minint + 0.0) < minint)))
195−assert((maxint < (minint * - 1.0)))
196−assert((maxint <= (minint * - 1.0)))
193+assert((not (minint < (minint + 0.0))))
194+assert((not ((minint + 0.0) < minint)))
195+assert((maxint < (minint * (- 1.0))))
196+assert((maxint <= (minint * (- 1.0))))
197197do
198−local fmaxi1 = (0x2 ^ ((intbits - 0x1)))
198+local fmaxi1 = (0x2 ^ (intbits - 0x1))
199199assert((maxint < fmaxi1))
200200assert((maxint <= fmaxi1))
201−assert(not ((fmaxi1 <= maxint)))
202−assert((minint <= - (0x2 ^ ((intbits - 0x1)))))
203−assert(- ((0x2 ^ ((intbits - 0x1))) <= minint))
201+assert((not (fmaxi1 <= maxint)))
202+assert((minint <= (- (0x2 ^ (intbits - 0x1)))))
203+assert((- ((0x2 ^ (intbits - 0x1)) <= minint)))
204204end
205205if (floatbits < intbits) then
206206print("\u{74}\u{65}\u{73}\u{74}\u{69}\u{6e}\u{67}\u{20}\u{6f}\u{72}\u{64}\u{65}\u{72}\u{20}\u{28}\u{66}\u{6c}\u{6f}\u{61}\u{74}\u{73}\u{20}\u{63}\u{61}\u{6e}\u{6e}\u{6f}\u{74}\u{20}\u{72}\u{65}\u{70}\u{72}\u{65}\u{73}\u{65}\u{6e}\u{74}\u{20}\u{61}\u{6c}\u{6c}\u{20}\u{69}\u{6e}\u{74}\u{65}\u{67}\u{65}\u{72}\u{73}\u{29}")
@@ -208,56 +208,56 @@ local fmax = (0x2 ^ floatbits)
208208local ifmax = (fmax | 0x0)
209209assert((fmax < (ifmax + 0x1)))
210210assert(((fmax - 0x1) < ifmax))
211−assert(- (((fmax - 0x1)) > - ifmax))
212−assert(not ((fmax <= (ifmax - 0x1))))
213−assert(- (fmax > - ((ifmax + 0x1))))
214−assert(not (- (fmax >= - ((ifmax - 0x1)))))
211+assert((- ((fmax - 0x1) > (- ifmax))))
212+assert((not (fmax <= (ifmax - 0x1))))
213+assert((- (fmax > (- (ifmax + 0x1)))))
214+assert((not (- (fmax >= (- (ifmax - 0x1))))))
215215assert((((fmax / 0x2) - 0.5) < (ifmax // 0x2)))
216−assert(- ((((fmax / 0x2) - 0.5)) > - (ifmax // 0x2)))
216+assert((- (((fmax / 0x2) - 0.5) > (- (ifmax // 0x2)))))
217217assert((maxint < (0x2 ^ intbits)))
218−assert((minint > - (0x2 ^ intbits)))
218+assert((minint > (- (0x2 ^ intbits))))
219219assert((maxint <= (0x2 ^ intbits)))
220−assert((minint >= - (0x2 ^ intbits)))
220+assert((minint >= (- (0x2 ^ intbits))))
221221else
222222print("\u{74}\u{65}\u{73}\u{74}\u{69}\u{6e}\u{67}\u{20}\u{6f}\u{72}\u{64}\u{65}\u{72}\u{20}\u{28}\u{66}\u{6c}\u{6f}\u{61}\u{74}\u{73}\u{20}\u{63}\u{61}\u{6e}\u{20}\u{72}\u{65}\u{70}\u{72}\u{65}\u{73}\u{65}\u{6e}\u{74}\u{20}\u{61}\u{6c}\u{6c}\u{20}\u{69}\u{6e}\u{74}\u{65}\u{67}\u{65}\u{72}\u{73}\u{29}")
223223assert((maxint < (maxint + 1.0)))
224224assert((maxint < (maxint + 0.5)))
225225assert(((maxint - 1.0) < maxint))
226226assert(((maxint - 0.5) < maxint))
227−assert(not (((maxint + 0.0) < maxint)))
227+assert((not ((maxint + 0.0) < maxint)))
228228assert(((maxint + 0.0) <= maxint))
229−assert(not ((maxint < (maxint + 0.0))))
229+assert((not (maxint < (maxint + 0.0))))
230230assert(((maxint + 0.0) <= maxint))
231231assert((maxint <= (maxint + 0.0)))
232−assert(not (((maxint + 1.0) <= maxint)))
233−assert(not (((maxint + 0.5) <= maxint)))
234−assert(not ((maxint <= (maxint - 1.0))))
235−assert(not ((maxint <= (maxint - 0.5))))
232+assert((not ((maxint + 1.0) <= maxint)))
233+assert((not ((maxint + 0.5) <= maxint)))
234+assert((not (maxint <= (maxint - 1.0))))
235+assert((not (maxint <= (maxint - 0.5))))
236236assert((minint < (minint + 1.0)))
237237assert((minint < (minint + 0.5)))
238238assert((minint <= (minint + 0.5)))
239239assert(((minint - 1.0) < minint))
240240assert(((minint - 1.0) <= minint))
241−assert(not (((minint + 0.0) < minint)))
242−assert(not (((minint + 0.5) < minint)))
243−assert(not ((minint < (minint + 0.0))))
241+assert((not ((minint + 0.0) < minint)))
242+assert((not ((minint + 0.5) < minint)))
243+assert((not (minint < (minint + 0.0))))
244244assert(((minint + 0.0) <= minint))
245245assert((minint <= (minint + 0.0)))
246−assert(not (((minint + 1.0) <= minint)))
247−assert(not (((minint + 0.5) <= minint)))
248−assert(not ((minint <= (minint - 1.0))))
246+assert((not ((minint + 1.0) <= minint)))
247+assert((not ((minint + 0.5) <= minint)))
248+assert((not (minint <= (minint - 1.0))))
249249end
250250do
251251local NaN <const> = (0x0 / 0x0)
252−assert(not ((NaN < 0x0)))
253−assert(not ((NaN > minint)))
254−assert(not ((NaN <= - 0x9)))
255−assert(not ((NaN <= maxint)))
256−assert(not ((NaN < maxint)))
257−assert(not ((minint <= NaN)))
258−assert(not ((minint < NaN)))
259−assert(not ((0x4 <= NaN)))
260−assert(not ((0x4 < NaN)))
252+assert((not (NaN < 0x0)))
253+assert((not (NaN > minint)))
254+assert((not (NaN <= (- 0x9))))
255+assert((not (NaN <= maxint)))
256+assert((not (NaN < maxint)))
257+assert((not (minint <= NaN)))
258+assert((not (minint < NaN)))
259+assert((not (0x4 <= NaN)))
260+assert((not (0x4 < NaN)))
261261end
262262local function checkcompt
263263(msg,code)
@@ -274,16 +274,16 @@ local function f2i
274274return (x | x)
275275end
276276checkerror(msgf2i,f2i,math.huge)
277−checkerror(msgf2i,f2i,- math.huge)
277+checkerror(msgf2i,f2i,(- math.huge))
278278checkerror(msgf2i,f2i,(0x0 / 0x0))
279279if (floatbits < intbits) then
280280assert(((maxint + 1.0) == (maxint + 0.0)))
281281assert(((minint - 1.0) == (minint + 0.0)))
282282checkerror(msgf2i,f2i,(maxint + 0.0))
283−assert((f2i((2.0 ^ ((intbits - 0x2)))) == (0x1 << ((intbits - 0x2)))))
284−assert((f2i(- (2.0 ^ ((intbits - 0x2)))) == - ((0x1 << ((intbits - 0x2))))))
285−assert((((((2.0 ^ ((floatbits - 0x1))) + 1.0)) // 0x1) == (((0x1 << ((floatbits - 0x1)))) + 0x1)))
286−local mf = ((maxint - ((0x1 << ((floatbits - intbits))))) + 0x1)
283+assert((f2i((2.0 ^ (intbits - 0x2))) == (0x1 << (intbits - 0x2))))
284+assert((f2i((- (2.0 ^ (intbits - 0x2)))) == (- (0x1 << (intbits - 0x2)))))
285+assert(((((2.0 ^ (floatbits - 0x1)) + 1.0) // 0x1) == ((0x1 << (floatbits - 0x1)) + 0x1)))
286+local mf = ((maxint - (0x1 << (floatbits - intbits))) + 0x1)
287287assert((f2i((mf + 0.0)) == mf))
288288mf=(mf + 0x1)
289289assert((f2i((mf + 0.0)) ~= mf))
@@ -297,8 +297,8 @@ end
297297assert((f2i((minint + 0.0)) == minint))
298298assert((("\u{32}" + 0x1) == 0x3))
299299assert((("\u{32}\u{20}" + 0x1) == 0x3))
300−assert((("\u{20}\u{2d}\u{32}\u{20}" + 0x1) == - 0x1))
301−assert((("\u{20}\u{2d}\u{30}\u{78}\u{61}\u{20}" + 0x1) == - 0x9))
300+assert((("\u{20}\u{2d}\u{32}\u{20}" + 0x1) == (- 0x1)))
301+assert((("\u{20}\u{2d}\u{30}\u{78}\u{61}\u{20}" + 0x1) == (- 0x9)))
302302do
303303assert(eqT(tonumber(tostring(maxint)),maxint))
304304assert(eqT(tonumber(tostring(minint)),minint))
@@ -314,53 +314,53 @@ end
314314assert(eqT(tonumber(incd(maxint)),(maxint + 1.0)))
315315assert(eqT(tonumber(incd(minint)),(minint - 1.0)))
316316assert(eqT(tonumber(("\u{31}" .. string.rep("\u{30}",0x1e))),1e30))
317−assert(eqT(tonumber(("\u{2d}\u{31}" .. string.rep("\u{30}",0x1e))),- 1e30))
317+assert(eqT(tonumber(("\u{2d}\u{31}" .. string.rep("\u{30}",0x1e))),(- 1e30)))
318318assert(eqT(tonumber(("\u{30}\u{78}\u{31}" .. string.rep("\u{30}",0x1e))),0x0))
319319assert((minint == load(("\u{72}\u{65}\u{74}\u{75}\u{72}\u{6e}\u{20}" .. minint))()))
320320assert(eqT(maxint,load(("\u{72}\u{65}\u{74}\u{75}\u{72}\u{6e}\u{20}" .. maxint))()))
321321assert(eqT(1e22,1e22))
322−assert(eqT(- 1e22,- 1e22))
322+assert(eqT((- 1e22),(- 1e22)))
323323end
324324assert((tonumber(3.4) == 3.4))
325325assert(eqT(tonumber(0x3),0x3))
326326assert((eqT(tonumber(maxint),maxint) and eqT(tonumber(minint),minint)))
327327assert((tonumber((0x1 / 0x0)) == (0x1 / 0x0)))
328328assert((tonumber("\u{30}") == 0x0))
329−assert(not tonumber(""))
330−assert(not tonumber("\u{20}\u{20}"))
331−assert(not tonumber("\u{2d}"))
332−assert(not tonumber("\u{20}\u{20}\u{2d}\u{30}\u{78}\u{20}"))
333−assert(not tonumber({}))
334−assert(((((tonumber("\u{2b}\u{30}\u{2e}\u{30}\u{31}") == (0x1 / 0x64)) and (tonumber("\u{2b}\u{2e}\u{30}\u{31}") == 0.01)) and (tonumber("\u{2e}\u{30}\u{31}") == 0.01)) and (tonumber("\u{2d}\u{31}\u{2e}") == - (0x1 and (tonumber("\u{2b}\u{31}\u{2e}") == 0x1)))))
335−assert(not (tonumber("\u{2b}\u{20}\u{30}\u{2e}\u{30}\u{31}") and not (tonumber("\u{2b}\u{2e}\u{65}\u{31}") and not (tonumber("\u{31}\u{65}") and not (tonumber("\u{31}\u{2e}\u{30}\u{65}\u{2b}") and not tonumber("\u{2e}"))))))
336−assert((tonumber("\u{2d}\u{30}\u{31}\u{32}") == - (0xa - 0x2)))
337−assert((tonumber("\u{2d}\u{31}\u{2e}\u{32}\u{65}\u{32}") == - - - 0x78))
338−assert((tonumber("\u{30}\u{78}\u{66}\u{66}\u{66}\u{66}\u{66}\u{66}\u{66}\u{66}\u{66}\u{66}\u{66}\u{66}") == (((0x1 << ((0x4 * 0xc)))) - 0x1)))
339−assert((tonumber(("\u{30}\u{78}" .. string.rep("\u{66}",((intbits // 0x4))))) == - 0x1))
340−assert((tonumber(("\u{2d}\u{30}\u{78}" .. string.rep("\u{66}",((intbits // 0x4))))) == 0x1))
329+assert((not tonumber("")))
330+assert((not tonumber("\u{20}\u{20}")))
331+assert((not tonumber("\u{2d}")))
332+assert((not tonumber("\u{20}\u{20}\u{2d}\u{30}\u{78}\u{20}")))
333+assert((not tonumber({})))
334+assert(((((tonumber("\u{2b}\u{30}\u{2e}\u{30}\u{31}") == (0x1 / 0x64)) and (tonumber("\u{2b}\u{2e}\u{30}\u{31}") == 0.01)) and (tonumber("\u{2e}\u{30}\u{31}") == 0.01)) and (tonumber("\u{2d}\u{31}\u{2e}") == (- (0x1 and (tonumber("\u{2b}\u{31}\u{2e}") == 0x1))))))
335+assert((not (tonumber("\u{2b}\u{20}\u{30}\u{2e}\u{30}\u{31}") and (not (tonumber("\u{2b}\u{2e}\u{65}\u{31}") and (not (tonumber("\u{31}\u{65}") and (not (tonumber("\u{31}\u{2e}\u{30}\u{65}\u{2b}") and (not tonumber("\u{2e}")))))))))))
336+assert((tonumber("\u{2d}\u{30}\u{31}\u{32}") == (- (0xa - 0x2))))
337+assert((tonumber("\u{2d}\u{31}\u{2e}\u{32}\u{65}\u{32}") == (- (- (- 0x78)))))
338+assert((tonumber("\u{30}\u{78}\u{66}\u{66}\u{66}\u{66}\u{66}\u{66}\u{66}\u{66}\u{66}\u{66}\u{66}\u{66}") == ((0x1 << (0x4 * 0xc)) - 0x1)))
339+assert((tonumber(("\u{30}\u{78}" .. string.rep("\u{66}",(intbits // 0x4)))) == (- 0x1)))
340+assert((tonumber(("\u{2d}\u{30}\u{78}" .. string.rep("\u{66}",(intbits // 0x4)))) == 0x1))
341341assert((tonumber("\u{20}\u{20}\u{30}\u{30}\u{31}\u{30}\u{31}\u{30}\u{20}\u{20}",0x2) == 0xa))
342342assert((tonumber("\u{20}\u{20}\u{30}\u{30}\u{31}\u{30}\u{31}\u{30}\u{20}\u{20}",0xa) == 0x3f2))
343−assert((tonumber("\u{20}\u{20}\u{2d}\u{31}\u{30}\u{31}\u{30}\u{20}\u{20}",0x2) == - 0xa))
343+assert((tonumber("\u{20}\u{20}\u{2d}\u{31}\u{30}\u{31}\u{30}\u{20}\u{20}",0x2) == (- 0xa)))
344344assert((tonumber("\u{31}\u{30}",0x24) == 0x24))
345−assert((tonumber("\u{20}\u{20}\u{2d}\u{31}\u{30}\u{20}\u{20}",0x24) == - 0x24))
345+assert((tonumber("\u{20}\u{20}\u{2d}\u{31}\u{30}\u{20}\u{20}",0x24) == (- 0x24)))
346346assert((tonumber("\u{20}\u{20}\u{2b}\u{31}\u{5a}\u{20}\u{20}",0x24) == (0x24 + 0x23)))
347−assert((tonumber("\u{20}\u{20}\u{2d}\u{31}\u{7a}\u{20}\u{20}",0x24) == - (0x24 + - 0x23)))
348−assert((tonumber("\u{2d}\u{66}\u{46}\u{66}\u{61}",0x10) == - ((0xa + ((0x10 * ((0xf + ((0x10 * ((0xf + ((0x10 * 0xf))))))))))))))
349−assert(((tonumber(string.rep("\u{31}",((intbits - 0x2))),0x2) + 0x1) == (0x2 ^ ((intbits - 0x2)))))
350−assert(((tonumber("\u{66}\u{66}\u{66}\u{66}\u{46}\u{46}\u{46}\u{46}",0x10) + 0x1) == ((0x1 << 0x20))))
351−assert(((tonumber("\u{30}\u{66}\u{66}\u{66}\u{66}\u{46}\u{46}\u{46}\u{46}",0x10) + 0x1) == ((0x1 << 0x20))))
352−assert(((tonumber("\u{2d}\u{30}\u{66}\u{66}\u{66}\u{66}\u{66}\u{66}\u{46}\u{46}\u{46}\u{46}",0x10) - 0x1) == - ((0x1 << 0x28))))
347+assert((tonumber("\u{20}\u{20}\u{2d}\u{31}\u{7a}\u{20}\u{20}",0x24) == (- (0x24 + (- 0x23)))))
348+assert((tonumber("\u{2d}\u{66}\u{46}\u{66}\u{61}",0x10) == (- (0xa + (0x10 * (0xf + (0x10 * (0xf + (0x10 * 0xf)))))))))
349+assert(((tonumber(string.rep("\u{31}",(intbits - 0x2)),0x2) + 0x1) == (0x2 ^ (intbits - 0x2))))
350+assert(((tonumber("\u{66}\u{66}\u{66}\u{66}\u{46}\u{46}\u{46}\u{46}",0x10) + 0x1) == (0x1 << 0x20)))
351+assert(((tonumber("\u{30}\u{66}\u{66}\u{66}\u{66}\u{46}\u{46}\u{46}\u{46}",0x10) + 0x1) == (0x1 << 0x20)))
352+assert(((tonumber("\u{2d}\u{30}\u{66}\u{66}\u{66}\u{66}\u{66}\u{66}\u{46}\u{46}\u{46}\u{46}",0x10) - 0x1) == (- (0x1 << 0x28))))
353353for i = 0x2, 0x24
354354do
355355local i2 = (i * i)
356356local i10 = ((((i2 * i2) * i2) * i2) * i2)
357357assert((tonumber("\u{9}\u{31}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{9}",i) == i10))
358358end
359−if not _soft then
360−assert((tonumber(("\u{30}\u{78}" .. (string.rep("\u{66}",0xd) .. "\u{2e}\u{30}"))) == ((2.0 ^ ((0x4 * 0xd))) - 0x1)))
361−assert((tonumber(("\u{30}\u{78}" .. (string.rep("\u{66}",0x96) .. "\u{2e}\u{30}"))) == ((2.0 ^ ((0x4 * 0x96))) - 0x1)))
362−assert((tonumber(("\u{30}\u{78}" .. (string.rep("\u{66}",0x12c) .. "\u{2e}\u{30}"))) == ((2.0 ^ ((0x4 * 0x12c))) - 0x1)))
363−assert((tonumber(("\u{30}\u{78}" .. (string.rep("\u{66}",0x1f4) .. "\u{2e}\u{30}"))) == ((2.0 ^ ((0x4 * 0x1f4))) - 0x1)))
359+if (not _soft) then
360+assert((tonumber(("\u{30}\u{78}" .. (string.rep("\u{66}",0xd) .. "\u{2e}\u{30}"))) == ((2.0 ^ (0x4 * 0xd)) - 0x1)))
361+assert((tonumber(("\u{30}\u{78}" .. (string.rep("\u{66}",0x96) .. "\u{2e}\u{30}"))) == ((2.0 ^ (0x4 * 0x96)) - 0x1)))
362+assert((tonumber(("\u{30}\u{78}" .. (string.rep("\u{66}",0x12c) .. "\u{2e}\u{30}"))) == ((2.0 ^ (0x4 * 0x12c)) - 0x1)))
363+assert((tonumber(("\u{30}\u{78}" .. (string.rep("\u{66}",0x1f4) .. "\u{2e}\u{30}"))) == ((2.0 ^ (0x4 * 0x1f4)) - 0x1)))
364364assert((tonumber(("\u{30}\u{78}\u{33}\u{2e}" .. string.rep("\u{30}",0x3e8))) == 0x3))
365365assert((tonumber(("\u{30}\u{78}" .. (string.rep("\u{30}",0x3e8) .. "\u{61}"))) == 0xa))
366366assert((tonumber(("\u{30}\u{78}\u{30}\u{2e}" .. (string.rep("\u{30}",0xd) .. "\u{31}"))) == (2.0 ^ (- (0x4 * 0xe)))))
@@ -373,53 +373,53 @@ end
373373local function f
374374(...)
375375if (select("\u{23}",...) == 0x1) then
376−return (...)
376+return ...
377377else
378378return "\u{2a}\u{2a}\u{2a}"
379379end
380380end
381−assert(not f(tonumber("\u{66}\u{46}\u{66}\u{61}",0xf)))
382−assert(not f(tonumber("\u{30}\u{39}\u{39}",0x8)))
383−assert(not f(tonumber("\u{31}\u{0}",0x2)))
384−assert(not f(tonumber("",0x8)))
385−assert(not f(tonumber("\u{20}\u{20}",0x9)))
386−assert(not f(tonumber("\u{20}\u{20}",0x9)))
387−assert(not f(tonumber("\u{30}\u{78}\u{66}",0xa)))
388−assert(not f(tonumber("\u{69}\u{6e}\u{66}")))
389−assert(not f(tonumber("\u{20}\u{49}\u{4e}\u{46}\u{20}")))
390−assert(not f(tonumber("\u{4e}\u{61}\u{6e}")))
391−assert(not f(tonumber("\u{6e}\u{61}\u{6e}")))
392−assert(not f(tonumber("\u{20}\u{20}")))
393−assert(not f(tonumber("")))
394−assert(not f(tonumber("\u{31}\u{20}\u{20}\u{61}")))
395−assert(not f(tonumber("\u{31}\u{20}\u{20}\u{61}",0x2)))
396−assert(not f(tonumber("\u{31}\u{0}")))
397−assert(not f(tonumber("\u{31}\u{20}\u{0}")))
398−assert(not f(tonumber("\u{31}\u{0}\u{20}")))
399−assert(not f(tonumber("\u{65}\u{31}")))
400−assert(not f(tonumber("\u{65}\u{20}\u{20}\u{31}")))
401−assert(not f(tonumber("\u{20}\u{33}\u{2e}\u{34}\u{2e}\u{35}\u{20}")))
402−assert(not tonumber("\u{30}\u{78}"))
403−assert(not tonumber("\u{78}"))
404−assert(not tonumber("\u{78}\u{33}"))
405−assert(not tonumber("\u{30}\u{78}\u{33}\u{2e}\u{33}\u{2e}\u{33}"))
406−assert(not tonumber("\u{30}\u{30}\u{78}\u{32}"))
407−assert(not tonumber("\u{30}\u{78}\u{20}\u{32}"))
408−assert(not tonumber("\u{30}\u{20}\u{78}\u{32}"))
409−assert(not tonumber("\u{32}\u{33}\u{78}"))
410−assert(not tonumber("\u{2d}\u{20}\u{30}\u{78}\u{61}\u{61}"))
411−assert(not tonumber("\u{2d}\u{30}\u{78}\u{61}\u{61}\u{50}\u{20}"))
412−assert(not tonumber("\u{30}\u{78}\u{30}\u{2e}\u{35}\u{31}\u{70}"))
413−assert(not tonumber("\u{30}\u{78}\u{35}\u{70}\u{2b}\u{2d}\u{32}"))
381+assert((not f(tonumber("\u{66}\u{46}\u{66}\u{61}",0xf))))
382+assert((not f(tonumber("\u{30}\u{39}\u{39}",0x8))))
383+assert((not f(tonumber("\u{31}\u{0}",0x2))))
384+assert((not f(tonumber("",0x8))))
385+assert((not f(tonumber("\u{20}\u{20}",0x9))))
386+assert((not f(tonumber("\u{20}\u{20}",0x9))))
387+assert((not f(tonumber("\u{30}\u{78}\u{66}",0xa))))
388+assert((not f(tonumber("\u{69}\u{6e}\u{66}"))))
389+assert((not f(tonumber("\u{20}\u{49}\u{4e}\u{46}\u{20}"))))
390+assert((not f(tonumber("\u{4e}\u{61}\u{6e}"))))
391+assert((not f(tonumber("\u{6e}\u{61}\u{6e}"))))
392+assert((not f(tonumber("\u{20}\u{20}"))))
393+assert((not f(tonumber(""))))
394+assert((not f(tonumber("\u{31}\u{20}\u{20}\u{61}"))))
395+assert((not f(tonumber("\u{31}\u{20}\u{20}\u{61}",0x2))))
396+assert((not f(tonumber("\u{31}\u{0}"))))
397+assert((not f(tonumber("\u{31}\u{20}\u{0}"))))
398+assert((not f(tonumber("\u{31}\u{0}\u{20}"))))
399+assert((not f(tonumber("\u{65}\u{31}"))))
400+assert((not f(tonumber("\u{65}\u{20}\u{20}\u{31}"))))
401+assert((not f(tonumber("\u{20}\u{33}\u{2e}\u{34}\u{2e}\u{35}\u{20}"))))
402+assert((not tonumber("\u{30}\u{78}")))
403+assert((not tonumber("\u{78}")))
404+assert((not tonumber("\u{78}\u{33}")))
405+assert((not tonumber("\u{30}\u{78}\u{33}\u{2e}\u{33}\u{2e}\u{33}")))
406+assert((not tonumber("\u{30}\u{30}\u{78}\u{32}")))
407+assert((not tonumber("\u{30}\u{78}\u{20}\u{32}")))
408+assert((not tonumber("\u{30}\u{20}\u{78}\u{32}")))
409+assert((not tonumber("\u{32}\u{33}\u{78}")))
410+assert((not tonumber("\u{2d}\u{20}\u{30}\u{78}\u{61}\u{61}")))
411+assert((not tonumber("\u{2d}\u{30}\u{78}\u{61}\u{61}\u{50}\u{20}")))
412+assert((not tonumber("\u{30}\u{78}\u{30}\u{2e}\u{35}\u{31}\u{70}")))
413+assert((not tonumber("\u{30}\u{78}\u{35}\u{70}\u{2b}\u{2d}\u{32}")))
414414assert((((0x10 == 0x10) and (0xfff == ((0x2 ^ 0xc) - 0x1))) and (0xfb == 0xfb)))
415415assert(((0.0 == 0x0) and (0.0 == 0x0)))
416−assert((0xffffffff == (((0x1 << 0x20)) - 0x1)))
416+assert((0xffffffff == ((0x1 << 0x20) - 0x1)))
417417assert((tonumber("\u{2b}\u{30}\u{78}\u{32}") == 0x2))
418−assert((tonumber("\u{2d}\u{30}\u{78}\u{61}\u{41}") == - 0xaa))
419−assert((tonumber("\u{2d}\u{30}\u{78}\u{66}\u{66}\u{46}\u{46}\u{46}\u{66}\u{66}\u{66}") == - (((0x1 << 0x20)) + 0x1)))
418+assert((tonumber("\u{2d}\u{30}\u{78}\u{61}\u{41}") == (- 0xaa)))
419+assert((tonumber("\u{2d}\u{30}\u{78}\u{66}\u{66}\u{46}\u{46}\u{46}\u{66}\u{66}\u{66}") == (- ((0x1 << 0x20) + 0x1))))
420420assert((((0.0 == 0x0) and ((0xe + 0x1) == 0xf)) and ((0xe - 0x1) == 0xd)))
421421assert((tonumber("\u{20}\u{20}\u{30}\u{78}\u{32}\u{2e}\u{35}\u{20}\u{20}") == (0x25 / 0x10)))
422−assert((tonumber("\u{20}\u{20}\u{2d}\u{30}\u{78}\u{32}\u{2e}\u{35}\u{20}\u{20}") == - (0x25 / 0x10)))
422+assert((tonumber("\u{20}\u{20}\u{2d}\u{30}\u{78}\u{32}\u{2e}\u{35}\u{20}\u{20}") == (- (0x25 / 0x10))))
423423assert((tonumber("\u{20}\u{20}\u{2b}\u{30}\u{78}\u{30}\u{2e}\u{35}\u{31}\u{70}\u{2b}\u{38}\u{20}\u{20}") == 0x51))
424424assert((0.9999999997671694 == (0x1 - "\u{30}\u{78}\u{2e}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{31}")))
425425assert((("\u{30}\u{78}\u{41}\u{2e}\u{61}" + 0x0) == (0xa + (0xa / 0x10))))
@@ -435,73 +435,73 @@ assert(((tonumber("\u{31}\u{31}\u{31}\u{31}\u{31}\u{31}\u{31}\u{31}\u{31}\u{31}"
435435assert(((1e-31 > 9e-32) and (9e29 < 1e30)))
436436assert((0.123456 > 0.123455))
437437assert((tonumber("\u{2b}\u{31}\u{2e}\u{32}\u{33}\u{45}\u{31}\u{38}") == (1.23 * (10.0 ^ 0x12))))
438−assert(not ((((0x1 < 0x1)) and ((0x1 < 0x2))) and not ((0x2 < 0x1))))
439−assert(not (((("\u{61}" < "\u{61}")) and (("\u{61}" < "\u{62}"))) and not (("\u{62}" < "\u{61}"))))
440−assert(((((0x1 <= 0x1)) and ((0x1 <= 0x2))) and not ((0x2 <= 0x1))))
441−assert((((("\u{61}" <= "\u{61}")) and (("\u{61}" <= "\u{62}"))) and not (("\u{62}" <= "\u{61}"))))
442−assert(not (((0x1 > 0x1)) and not (((0x1 > 0x2)) and ((0x2 > 0x1)))))
443−assert(not ((("\u{61}" > "\u{61}")) and not ((("\u{61}" > "\u{62}")) and (("\u{62}" > "\u{61}")))))
444−assert((((0x1 >= 0x1)) and not (((0x1 >= 0x2)) and ((0x2 >= 0x1)))))
445−assert(((("\u{61}" >= "\u{61}")) and not ((("\u{61}" >= "\u{62}")) and (("\u{62}" >= "\u{61}")))))
446−assert((((1.3 < 1.4) and (1.3 <= 1.4)) and not (((1.3 < 1.3)) and (1.3 <= 1.3))))
447−assert(eqT(- (0x4 % 0x3),0x2))
448−assert(eqT((0x4 % - 0x3),- 0x2))
449−assert(eqT(- (4.0 % 0x3),2.0))
450−assert(eqT((0x4 % - 3.0),- 2.0))
451−assert(eqT((0x4 % - 0x5),- 0x1))
452−assert(eqT((0x4 % - 5.0),- 1.0))
438+assert((not (((0x1 < 0x1) and (0x1 < 0x2)) and (not (0x2 < 0x1)))))
439+assert((not ((("\u{61}" < "\u{61}") and ("\u{61}" < "\u{62}")) and (not ("\u{62}" < "\u{61}")))))
440+assert((((0x1 <= 0x1) and (0x1 <= 0x2)) and (not (0x2 <= 0x1))))
441+assert(((("\u{61}" <= "\u{61}") and ("\u{61}" <= "\u{62}")) and (not ("\u{62}" <= "\u{61}"))))
442+assert((not ((0x1 > 0x1) and (not ((0x1 > 0x2) and (0x2 > 0x1))))))
443+assert((not (("\u{61}" > "\u{61}") and (not (("\u{61}" > "\u{62}") and ("\u{62}" > "\u{61}"))))))
444+assert(((0x1 >= 0x1) and (not ((0x1 >= 0x2) and (0x2 >= 0x1)))))
445+assert((("\u{61}" >= "\u{61}") and (not (("\u{61}" >= "\u{62}") and ("\u{62}" >= "\u{61}")))))
446+assert((((1.3 < 1.4) and (1.3 <= 1.4)) and (not ((1.3 < 1.3) and (1.3 <= 1.3)))))
447+assert(eqT((- (0x4 % 0x3)),0x2))
448+assert(eqT((0x4 % (- 0x3)),(- 0x2)))
449+assert(eqT((- (4.0 % 0x3)),2.0))
450+assert(eqT((0x4 % (- 3.0)),(- 2.0)))
451+assert(eqT((0x4 % (- 0x5)),(- 0x1)))
452+assert(eqT((0x4 % (- 5.0)),(- 1.0)))
453453assert(eqT((0x4 % 0x5),0x4))
454454assert(eqT((0x4 % 5.0),4.0))
455−assert(eqT(- (0x4 % - 0x5),- 0x4))
456−assert(eqT(- (0x4 % - 5.0),- 4.0))
457−assert(eqT(- (0x4 % 0x5),0x1))
458−assert(eqT(- (0x4 % 5.0),1.0))
455+assert(eqT((- (0x4 % (- 0x5))),(- 0x4)))
456+assert(eqT((- (0x4 % (- 5.0))),(- 4.0)))
457+assert(eqT((- (0x4 % 0x5)),0x1))
458+assert(eqT((- (0x4 % 5.0)),1.0))
459459assert(eqT((4.25 % 0x4),0.25))
460460assert(eqT((10.0 % 0x2),0.0))
461−assert(eqT(- (10.0 % 0x2),0.0))
462−assert(eqT(- (10.0 % - 0x2),0.0))
461+assert(eqT((- (10.0 % 0x2)),0.0))
462+assert(eqT((- (10.0 % (- 0x2))),0.0))
463463assert(((math.pi - (math.pi % 0x1)) == 0x3))
464464assert(((math.pi - (math.pi % 1e-3)) == 3.141))
465465do
466466local i,j = 0x0,0x4e20
467467while (i < j) do
468−local m = (((i + j)) // 0x2)
469−if (0xa ^ - (m > 0x0)) then
468+local m = ((i + j) // 0x2)
469+if (0xa ^ (- (m > 0x0))) then
470470i=(m + 0x1)
471471else
472472j=m
473473end
474474end
475−local b = (0xa ^ - ((i - ((i // 0xa)))))
475+local b = (0xa ^ (- (i - (i // 0xa))))
476476assert(((b > 0x0) and ((b * b) == 0x0)))
477477local delta = (b / 0x3e8)
478−assert(eq((((2.1 * b)) % ((0x2 * b))),((0.1 * b)),delta))
479−assert(eq(((- (2.1 * b)) % ((0x2 * b))),(((0x2 * b)) - ((0.1 * b))),delta))
480−assert(eq((((2.1 * b)) % (- (0x2 * b))),(((0.1 * b)) - ((0x2 * b))),delta))
478+assert(eq(((2.1 * b) % (0x2 * b)),(0.1 * b),delta))
479+assert(eq(((- (2.1 * b)) % (0x2 * b)),((0x2 * b) - (0.1 * b)),delta))
480+assert(eq(((2.1 * b) % (- (0x2 * b))),((0.1 * b) - (0x2 * b)),delta))
481481assert(eq(((- (2.1 * b)) % (- (0x2 * b))),(- (0.1 * b)),delta))
482482end
483−for i = - 0xa, 0xa
483+for i = (- 0xa), 0xa
484484do
485−for j = - 0xa, 0xa
485+for j = (- 0xa), 0xa
486486do
487487if (j ~= 0x0) then
488−assert(((((i + 0.0)) % j) == (i % j)))
488+assert((((i + 0.0) % j) == (i % j)))
489489end
490490end
491491end
492492for i = 0x0, 0xa
493493do
494−for j = - 0xa, 0xa
494+for j = (- 0xa), 0xa
495495do
496496if (j ~= 0x0) then
497−assert(((((0x2 ^ i)) % j) == (((0x1 << i)) % j)))
497+assert((((0x2 ^ i) % j) == ((0x1 << i) % j)))
498498end
499499end
500500end
501501do
502502local i = 0xa
503−while (((0x1 << i)) > 0x0) do
504−assert(((((0x1 << i)) % 0x3) == ((i % 0x2) + 0x1)))
503+while ((0x1 << i) > 0x0) do
504+assert((((0x1 << i) % 0x3) == ((i % 0x2) + 0x1)))
505505i=(i + 0x1)
506506end
507507i=0xa
@@ -512,13 +512,13 @@ end
512512end
513513assert(eqT((minint % minint),0x0))
514514assert(eqT((maxint % maxint),0x0))
515−assert(((((minint + 0x1)) % minint) == (minint + 0x1)))
516−assert(((((maxint - 0x1)) % maxint) == (maxint - 0x1)))
515+assert((((minint + 0x1) % minint) == (minint + 0x1)))
516+assert((((maxint - 0x1) % maxint) == (maxint - 0x1)))
517517assert(((minint % maxint) == (maxint - 0x1)))
518−assert((minint % - (0x1 == 0x0)))
519−assert((minint % - (0x2 == 0x0)))
520−assert((maxint % - (0x2 == - 0x1)))
521−if not _port then
518+assert((minint % (- (0x1 == 0x0))))
519+assert((minint % (- (0x2 == 0x0))))
520+assert((maxint % (- (0x2 == (- 0x1)))))
521+if (not _port) then
522522local function anan
523523(x)
524524assert(isNaN(x))
@@ -527,30 +527,30 @@ anan((0.0 % 0x0))
527527anan((1.3 % 0x0))
528528anan((math.huge % 0x1))
529529anan((math.huge % 1e30))
530−anan(- (math.huge % 1e30))
531−anan(- (math.huge % - 1e30))
530+anan((- (math.huge % 1e30)))
531+anan((- (math.huge % (- 1e30))))
532532assert(((0x1 % math.huge) == 0x1))
533533assert(((1e30 % math.huge) == 1e30))
534−assert((1e30 % - (math.huge == - math.huge)))
535−assert(- ((0x1 % math.huge) == math.huge))
536−assert(- (0x1 % - (math.huge == - 0x1)))
534+assert((1e30 % (- (math.huge == (- math.huge)))))
535+assert((- ((0x1 % math.huge) == math.huge)))
536+assert((- (0x1 % (- (math.huge == (- 0x1))))))
537537end
538538assert(math.ult(0x3,0x4))
539−assert(not math.ult(0x4,0x4))
540−assert(math.ult(- 0x2,- 0x1))
541−assert(math.ult(0x2,- 0x1))
542−assert(not math.ult(- 0x2,- 0x2))
539+assert((not math.ult(0x4,0x4)))
540+assert(math.ult((- 0x2),(- 0x1)))
541+assert(math.ult(0x2,(- 0x1)))
542+assert((not math.ult((- 0x2),(- 0x2))))
543543assert(math.ult(maxint,minint))
544−assert(not math.ult(minint,maxint))
545−assert(eq(((math.sin(- 9.8) ^ 0x2) + (math.cos(- 9.8) ^ 0x2)),0x1))
544+assert((not math.ult(minint,maxint)))
545+assert(eq(((math.sin((- 9.8)) ^ 0x2) + (math.cos((- 9.8)) ^ 0x2)),0x1))
546546assert(eq(math.tan((math.pi / 0x4)),0x1))
547547assert((eq(math.sin((math.pi / 0x2)),0x1) and eq(math.cos((math.pi / 0x2)),0x0)))
548548assert(((eq(math.atan(0x1),(math.pi / 0x4)) and eq(math.acos(0x0),(math.pi / 0x2))) and eq(math.asin(0x1),(math.pi / 0x2))))
549549assert((eq(math.deg((math.pi / 0x2)),0x5a) and eq(math.rad(0x5a),(math.pi / 0x2))))
550−assert((math.abs(- 10.43) == 10.43))
550+assert((math.abs((- 10.43)) == 10.43))
551551assert(eqT(math.abs(minint),minint))
552552assert(eqT(math.abs(maxint),maxint))
553−assert(eqT(math.abs(- maxint),maxint))
553+assert(eqT(math.abs((- maxint)),maxint))
554554assert(eq(math.atan(0x1,0x0),(math.pi / 0x2)))
555555assert((math.fmod(0xa,0x3) == 0x1))
556556assert(eq((math.sqrt(0xa) ^ 0x2),0xa))
@@ -558,17 +558,17 @@ assert(eq(math.log(0x2,0xa),(math.log(0x2) / math.log(0xa))))
558558assert(eq(math.log(0x2,0x2),0x1))
559559assert(eq(math.log(0x9,0x3),0x2))
560560assert(eq(math.exp(0x0),0x1))
561−assert(eq(math.sin(0xa),math.sin((0xa % ((0x2 * math.pi))))))
561+assert(eq(math.sin(0xa),math.sin((0xa % (0x2 * math.pi)))))
562562assert((tonumber("\u{20}\u{31}\u{2e}\u{33}\u{65}\u{2d}\u{32}\u{20}") == 0.013))
563−assert((tonumber("\u{20}\u{2d}\u{31}\u{2e}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{31}\u{20}") == - 1.00000000000001))
564−assert((0x800001 + - (0x800001 == 0x0)))
565−assert((0x800000 + - (0x800000 == 0x0)))
566−assert((0x7fffff + - (0x7fffff == 0x0)))
563+assert((tonumber("\u{20}\u{2d}\u{31}\u{2e}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{30}\u{31}\u{20}") == (- 1.00000000000001)))
564+assert((0x800001 + (- (0x800001 == 0x0))))
565+assert((0x800000 + (- (0x800000 == 0x0))))
566+assert((0x7fffff + (- (0x7fffff == 0x0))))
567567do
568568assert(eqT(math.floor(3.4),0x3))
569569assert(eqT(math.ceil(3.4),0x4))
570−assert(eqT(math.floor(- 3.4),- 0x4))
571−assert(eqT(math.ceil(- 3.4),- 0x3))
570+assert(eqT(math.floor((- 3.4)),(- 0x4)))
571+assert(eqT(math.ceil((- 3.4)),(- 0x3)))
572572assert(eqT(math.floor(maxint),maxint))
573573assert(eqT(math.ceil(maxint),maxint))
574574assert(eqT(math.floor(minint),minint))
@@ -577,8 +577,8 @@ assert(eqT(math.ceil(minint),minint))
577577assert(eqT(math.ceil((minint + 0.0)),minint))
578578assert((math.floor(1e50) == 1e50))
579579assert((math.ceil(1e50) == 1e50))
580−assert((math.floor(- 1e50) == - 1e50))
581−assert((math.ceil(- 1e50) == - 1e50))
580+assert((math.floor((- 1e50)) == (- 1e50)))
581+assert((math.ceil((- 1e50)) == (- 1e50)))
582582for _,p in pairs({0x1f,0x20,0x3f,0x40})
583583do
584584assert((math.floor((0x2 ^ p)) == (0x2 ^ p)))
@@ -593,30 +593,30 @@ assert(eqT(math.tointeger((minint .. "")),minint))
593593assert(eqT(math.tointeger(maxint),maxint))
594594assert(eqT(math.tointeger((maxint .. "")),maxint))
595595assert(eqT(math.tointeger((minint + 0.0)),minint))
596−assert(not math.tointeger((0.0 - minint)))
597−assert(not math.tointeger(math.pi))
598−assert(not math.tointeger(- math.pi))
596+assert((not math.tointeger((0.0 - minint))))
597+assert((not math.tointeger(math.pi)))
598+assert((not math.tointeger((- math.pi))))
599599assert((math.floor(math.huge) == math.huge))
600600assert((math.ceil(math.huge) == math.huge))
601−assert(not math.tointeger(math.huge))
602−assert((math.floor(- math.huge) == - math.huge))
603−assert((math.ceil(- math.huge) == - math.huge))
604−assert(not math.tointeger(- math.huge))
601+assert((not math.tointeger(math.huge)))
602+assert((math.floor((- math.huge)) == (- math.huge)))
603+assert((math.ceil((- math.huge)) == (- math.huge)))
604+assert((not math.tointeger((- math.huge))))
605605assert((math.tointeger("\u{33}\u{34}\u{2e}\u{30}") == 0x22))
606−assert(not math.tointeger("\u{33}\u{34}\u{2e}\u{33}"))
607−assert(not math.tointeger({}))
608−assert(not math.tointeger((0x0 / 0x0)))
606+assert((not math.tointeger("\u{33}\u{34}\u{2e}\u{33}")))
607+assert((not math.tointeger({})))
608+assert((not math.tointeger((0x0 / 0x0))))
609609end
610−for i = - 0x6, 0x6
610+for i = (- 0x6), 0x6
611611do
612−for j = - 0x6, 0x6
612+for j = (- 0x6), 0x6
613613do
614614if (j ~= 0x0) then
615615local mi = math.fmod(i,j)
616616local mf = math.fmod((i + 0.0),j)
617617assert((mi == mf))
618618assert(((math.type(mi) == "\u{69}\u{6e}\u{74}\u{65}\u{67}\u{65}\u{72}") and (math.type(mf) == "\u{66}\u{6c}\u{6f}\u{61}\u{74}")))
619−if (((((i >= 0x0) and (j >= 0x0))) or (((i <= 0x0) and (j <= 0x0)))) or (mi == 0x0)) then
619+if ((((i >= 0x0) and (j >= 0x0)) or ((i <= 0x0) and (j <= 0x0))) or (mi == 0x0)) then
620620assert(eqT(mi,(i % j)))
621621end
622622end
@@ -636,18 +636,18 @@ assert((math.max(maxint,1e61) == 1e61))
636636assert(eqT(math.max(minint,(minint + 0x1)),(minint + 0x1)))
637637assert(eqT(math.min(0x3),0x3))
638638assert(eqT(math.min(0x3,0x5,0x9,0x1),0x1))
639−assert((math.min(3.2,5.9,- 9.2,1.1) == - 9.2))
639+assert((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,minint) == - 1e61))
641+assert((math.min((- 1e61),minint) == (- 1e61)))
642642assert(eqT(math.min(maxint,(maxint - 0x1)),(maxint - 0x1)))
643643assert(eqT(math.min((maxint - 0x2),maxint,(maxint - 0x1)),(maxint - 0x2)))
644644end
645645local a,b = "\u{31}\u{30}","\u{32}\u{30}"
646−assert(((((a * b) == 0xc8) and ((a + b) == 0x1e)) and ((a - b) == - ((0xa and ((a / b) == 0.5)) and - (b == - 0x14)))))
646+assert(((((a * b) == 0xc8) and ((a + b) == 0x1e)) and ((a - b) == (- ((0xa and ((a / b) == 0.5)) and (- (b == (- 0x14))))))))
647647assert(((a == "\u{31}\u{30}") and (b == "\u{32}\u{30}")))
648648do
649649print("\u{74}\u{65}\u{73}\u{74}\u{69}\u{6e}\u{67}\u{20}\u{2d}\u{30}\u{20}\u{61}\u{6e}\u{64}\u{20}\u{4e}\u{61}\u{4e}")
650−local mz <const> = - 0.0
650+local mz <const> = (- 0.0)
651651local z <const> = 0.0
652652assert((mz == z))
653653assert((((0x1 / mz) < 0x0) and (0x0 < (0x1 / z))))
@@ -656,24 +656,24 @@ assert(((a[z] == 0x1) and (a[mz] == 0x1)))
656656a[z]=0x2
657657assert(((a[z] == 0x2) and (a[mz] == 0x2)))
658658local inf = ((math.huge * 0x2) + 0x1)
659−local mz <const> = - (0x1 / inf)
659+local mz <const> = (- (0x1 / inf))
660660local z <const> = (0x1 / inf)
661661assert((mz == z))
662662assert((((0x1 / mz) < 0x0) and (0x0 < (0x1 / z))))
663663local NaN <const> = (inf - inf)
664664assert((NaN ~= NaN))
665−assert(not ((NaN < NaN)))
666−assert(not ((NaN <= NaN)))
667−assert(not ((NaN > NaN)))
668−assert(not ((NaN >= NaN)))
669−assert(not (((0x0 < NaN)) and not ((NaN < 0x0))))
665+assert((not (NaN < NaN)))
666+assert((not (NaN <= NaN)))
667+assert((not (NaN > NaN)))
668+assert((not (NaN >= NaN)))
669+assert((not ((0x0 < NaN) and (not (NaN < 0x0)))))
670670local NaN1 <const> = (0x0 / 0x0)
671−assert(((NaN ~= NaN1) and not (((NaN <= NaN1)) and not ((NaN1 <= NaN)))))
671+assert(((NaN ~= NaN1) and (not ((NaN <= NaN1) and (not (NaN1 <= NaN))))))
672672local a = {}
673−assert(not pcall(rawset,a,NaN,0x1))
673+assert((not pcall(rawset,a,NaN,0x1)))
674674assert((a[NaN] == undef))
675675a[0x1]=0x1
676−assert(not pcall(rawset,a,NaN,0x1))
676+assert((not pcall(rawset,a,NaN,0x1)))
677677assert((a[NaN] == undef))
678678local a1,a2,a3,a4,a5 = 0x0,0x0,"\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}",0x0,"\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}"
679679assert((((a1 == a2) and (a2 == a4)) and (a1 ~= a3)))
@@ -683,23 +683,23 @@ print("\u{74}\u{65}\u{73}\u{74}\u{69}\u{6e}\u{67}\u{20}\u{27}\u{6d}\u{61}\u{74}\
683683local random,max,min = math.random,math.max,math.min
684684local function testnear
685685(val,ref,tol)
686−return ((math.abs((val - ref)) < (ref * tol)))
686+return (math.abs((val - ref)) < (ref * tol))
687687end
688688do
689689local h <const> = 0x7a7040a5
690690local l <const> = 0xa323c9d6
691691math.randomseed(0x3ef)
692−local res = ((((h << 0x20) | l)) & ~ (~ (0x0 << intbits)))
692+local res = (((h << 0x20) | l) & (~ (~ (0x0 << intbits))))
693693assert((random(0x0) == res))
694694math.randomseed(0x3ef,0x0)
695695local res
696696if (floatbits <= 0x20) then
697−res=(((h >> ((0x20 - floatbits)))) % (0x2 ^ 0x20))
697+res=((h >> (0x20 - floatbits)) % (0x2 ^ 0x20))
698698else
699−res=((((h % (0x2 ^ 0x20))) * (0x2 ^ ((floatbits - 0x20)))) + ((((l >> ((0x40 - floatbits)))) % (0x2 ^ 0x20))))
699+res=(((h % (0x2 ^ 0x20)) * (0x2 ^ (floatbits - 0x20))) + ((l >> (0x40 - floatbits)) % (0x2 ^ 0x20)))
700700end
701701local rand = random()
702−assert(eq(rand,0.4782753376376966,(0x2 ^ - floatbits)))
702+assert(eq(rand,0.4782753376376966,(0x2 ^ (- floatbits))))
703703assert(((rand * (0x2 ^ floatbits)) == res))
704704end
705705do
@@ -719,7 +719,7 @@ for i = 0x1, randbits
719719do
720720counts[i]=0x0
721721end
722−local up = - math.huge
722+local up = (- math.huge)
723723local low = math.huge
724724local rounds = (0x64 * randbits)
725725local totalrounds = 0x0
@@ -732,18 +732,18 @@ up=max(up,t)
732732low=min(low,t)
733733assert((((t * mult) % 0x1) == 0x0))
734734local bit = (i % randbits)
735−if ((((t * (0x2 ^ bit))) % 0x1) >= 0.5) then
735+if (((t * (0x2 ^ bit)) % 0x1) >= 0.5) then
736736counts[(bit + 0x1)]=(counts[(bit + 0x1)] + 0x1)
737737end
738738end
739739totalrounds=(totalrounds + rounds)
740−if not ((eq(up,0x1,1e-3) and eq(low,0x0,1e-3))) then
740+if (not (eq(up,0x1,1e-3) and eq(low,0x0,1e-3))) then
741741goto doagain
742742end
743−local expected = (((totalrounds / randbits) / 0x2))
743+local expected = ((totalrounds / randbits) / 0x2)
744744for i = 0x1, randbits
745745do
746−if not testnear(counts[i],expected,0.1) then
746+if (not testnear(counts[i],expected,0.1)) then
747747goto doagain
748748end
749749end
@@ -766,21 +766,21 @@ local t = random(0x0)
766766up=max(up,t)
767767low=min(low,t)
768768local bit = (i % intbits)
769−counts[(bit + 0x1)]=(counts[(bit + 0x1)] + ((((t >> bit)) & 0x1)))
769+counts[(bit + 0x1)]=(counts[(bit + 0x1)] + ((t >> bit) & 0x1))
770770end
771771totalrounds=(totalrounds + rounds)
772772local lim = (maxint >> 0xa)
773−if not ((((maxint - up) < lim) and ((low - minint) < lim))) then
773+if (not (((maxint - up) < lim) and ((low - minint) < lim))) then
774774goto doagain
775775end
776−local expected = (((totalrounds / intbits) / 0x2))
776+local expected = ((totalrounds / intbits) / 0x2)
777777for i = 0x1, intbits
778778do
779−if not testnear(counts[i],expected,0.1) then
779+if (not testnear(counts[i],expected,0.1)) then
780780goto doagain
781781end
782782end
783−print(string.format("\u{69}\u{6e}\u{74}\u{65}\u{67}\u{65}\u{72}\u{20}\u{72}\u{61}\u{6e}\u{64}\u{6f}\u{6d}\u{20}\u{72}\u{61}\u{6e}\u{67}\u{65}\u{20}\u{69}\u{6e}\u{20}\u{25}\u{64}\u{20}\u{63}\u{61}\u{6c}\u{6c}\u{73}\u{3a}\u{20}\u{5b}\u{6d}\u{69}\u{6e}\u{69}\u{6e}\u{74}\u{20}\u{2b}\u{20}\u{25}\u{2e}\u{30}\u{66}\u{70}\u{70}\u{6d}\u{2c}\u{20}\u{6d}\u{61}\u{78}\u{69}\u{6e}\u{74}\u{20}\u{2d}\u{20}\u{25}\u{2e}\u{30}\u{66}\u{70}\u{70}\u{6d}\u{5d}",totalrounds,((((minint - low)) / minint) * 1e6),((((maxint - up)) / maxint) * 1e6)))
783+print(string.format("\u{69}\u{6e}\u{74}\u{65}\u{67}\u{65}\u{72}\u{20}\u{72}\u{61}\u{6e}\u{64}\u{6f}\u{6d}\u{20}\u{72}\u{61}\u{6e}\u{67}\u{65}\u{20}\u{69}\u{6e}\u{20}\u{25}\u{64}\u{20}\u{63}\u{61}\u{6c}\u{6c}\u{73}\u{3a}\u{20}\u{5b}\u{6d}\u{69}\u{6e}\u{69}\u{6e}\u{74}\u{20}\u{2b}\u{20}\u{25}\u{2e}\u{30}\u{66}\u{70}\u{70}\u{6d}\u{2c}\u{20}\u{6d}\u{61}\u{78}\u{69}\u{6e}\u{74}\u{20}\u{2d}\u{20}\u{25}\u{2e}\u{30}\u{66}\u{70}\u{70}\u{6d}\u{5d}",totalrounds,(((minint - low) / minint) * 1e6),(((maxint - up) / maxint) * 1e6)))
784784end
785785do
786786local count = {0x0,0x0,0x0,0x0,0x0,0x0}
@@ -795,7 +795,7 @@ end
795795totalrep=(totalrep + rep)
796796for i = 0x1, 0x6
797797do
798−if not testnear(count[i],totalrep,0.05) then
798+if (not testnear(count[i],totalrep,0.05)) then
799799goto doagain
800800end
801801end
@@ -809,7 +809,7 @@ local count = 0x0
809809while true do
810810local t = random(x1,x2)
811811assert(((x1 <= t) and (t <= x2)))
812−if not mark[t] then
812+if (not mark[t]) then
813813mark[t]=true
814814count=(count + 0x1)
815815if (count == ((x2 - x1) + 0x1)) then
@@ -819,15 +819,15 @@ end
819819end
820820::ok::
821821end
822−aux(- 0xa,0x0)
822+aux((- 0xa),0x0)
823823aux(0x1,0x6)
824824aux(0x1,0x2)
825825aux(0x1,0xd)
826826aux(0x1,0x1f)
827827aux(0x1,0x20)
828828aux(0x1,0x21)
829−aux(- 0xa,0xa)
830−aux(- 0xa,- 0xa)
829+aux((- 0xa),0xa)
830+aux((- 0xa),(- 0xa))
831831aux(minint,minint)
832832aux(maxint,maxint)
833833aux(minint,(minint + 0x9))
@@ -846,7 +846,7 @@ local count = 0x0
846846for _ = 0x1, n
847847do
848848local t = random(p1,p2)
849−if not mark[t] then
849+if (not mark[t]) then
850850assert(((p1 <= t) and (t <= p2)))
851851max=math.max(max,t)
852852min=math.min(min,t)
@@ -854,26 +854,26 @@ mark[t]=true
854854count=(count + 0x1)
855855end
856856end
857−if not ((count >= (n * 0.8))) then
857+if (not (count >= (n * 0.8))) then
858858goto doagain
859859end
860−local diff = (((p2 - p1)) >> 0x4)
861−if not (((min < (p1 + diff)) and (max > (p2 - diff)))) then
860+local diff = ((p2 - p1) >> 0x4)
861+if (not ((min < (p1 + diff)) and (max > (p2 - diff)))) then
862862goto doagain
863863end
864864end
865865aux(0x0,maxint)
866866aux(0x1,maxint)
867867aux(0x3,(maxint // 0x3))
868−aux(minint,- 0x1)
868+aux(minint,(- 0x1))
869869aux((minint // 0x2),(maxint // 0x2))
870870aux(minint,maxint)
871871aux((minint + 0x1),maxint)
872872aux(minint,(maxint - 0x1))
873−aux(0x0,(0x1 << ((intbits - 0x5))))
873+aux(0x0,(0x1 << (intbits - 0x5)))
874874end
875−assert(not pcall(random,0x1,0x2,0x3))
876−assert(not pcall(random,(minint + 0x1),minint))
877−assert(not pcall(random,maxint,(maxint - 0x1)))
878−assert(not pcall(random,maxint,minint))
875+assert((not pcall(random,0x1,0x2,0x3)))
876+assert((not pcall(random,(minint + 0x1),minint)))
877+assert((not pcall(random,maxint,(maxint - 0x1))))
878+assert((not pcall(random,maxint,minint)))
879879print("\u{4f}\u{4b}")