| ... | @@ -28,13 +28,27 @@ fn testDivision() void { | ... | @@ -28,13 +28,27 @@ fn testDivision() void { |
| 28 | assert(divTrunc(f32, -5.0, 3.0) == -1.0); | 28 | assert(divTrunc(f32, -5.0, 3.0) == -1.0); |
| 29 | | 29 | |
| 30 | comptime { | 30 | comptime { |
| 31 | assert(1194735857077236777412821811143690633098347576 % 508740759824825164163191790951174292733114988 == 177254337427586449086438229241342047632117600,); | 31 | assert( |
| 32 | assert(@rem(-1194735857077236777412821811143690633098347576, 508740759824825164163191790951174292733114988) == -177254337427586449086438229241342047632117600,); | 32 | 1194735857077236777412821811143690633098347576 % 508740759824825164163191790951174292733114988 == 177254337427586449086438229241342047632117600, |
| 33 | assert(1194735857077236777412821811143690633098347576 / 508740759824825164163191790951174292733114988 == 2,); | 33 | ); |
| 34 | assert(@divTrunc(-1194735857077236777412821811143690633098347576, 508740759824825164163191790951174292733114988) == -2,); | 34 | assert( |
| 35 | assert(@divTrunc(1194735857077236777412821811143690633098347576, -508740759824825164163191790951174292733114988) == -2,); | 35 | @rem(-1194735857077236777412821811143690633098347576, 508740759824825164163191790951174292733114988) == -177254337427586449086438229241342047632117600, |
| 36 | assert(@divTrunc(-1194735857077236777412821811143690633098347576, -508740759824825164163191790951174292733114988) == 2,); | 36 | ); |
| 37 | assert(4126227191251978491697987544882340798050766755606969681711 % 10 == 1,); | 37 | assert( |
| | 38 | 1194735857077236777412821811143690633098347576 / 508740759824825164163191790951174292733114988 == 2, |
| | 39 | ); |
| | 40 | assert( |
| | 41 | @divTrunc(-1194735857077236777412821811143690633098347576, 508740759824825164163191790951174292733114988) == -2, |
| | 42 | ); |
| | 43 | assert( |
| | 44 | @divTrunc(1194735857077236777412821811143690633098347576, -508740759824825164163191790951174292733114988) == -2, |
| | 45 | ); |
| | 46 | assert( |
| | 47 | @divTrunc(-1194735857077236777412821811143690633098347576, -508740759824825164163191790951174292733114988) == 2, |
| | 48 | ); |
| | 49 | assert( |
| | 50 | 4126227191251978491697987544882340798050766755606969681711 % 10 == 1, |
| | 51 | ); |
| 38 | } | 52 | } |
| 39 | } | 53 | } |
| 40 | fn div(comptime T: type, a: T, b: T) T { | 54 | fn div(comptime T: type, a: T, b: T) T { |
| ... | @@ -324,8 +338,12 @@ test "big number addition" { | ... | @@ -324,8 +338,12 @@ test "big number addition" { |
| 324 | | 338 | |
| 325 | test "big number multiplication" { | 339 | test "big number multiplication" { |
| 326 | comptime { | 340 | comptime { |
| 327 | assert(45960427431263824329884196484953148229 * 128339149605334697009938835852565949723 == 5898522172026096622534201617172456926982464453350084962781392314016180490567,); | 341 | assert( |
| 328 | assert(594491908217841670578297176641415611445982232488944558774612 * 390603545391089362063884922208143568023166603618446395589768 == 232210647056203049913662402532976186578842425262306016094292237500303028346593132411865381225871291702600263463125370016,); | 342 | 45960427431263824329884196484953148229 * 128339149605334697009938835852565949723 == 5898522172026096622534201617172456926982464453350084962781392314016180490567, |
| | 343 | ); |
| | 344 | assert( |
| | 345 | 594491908217841670578297176641415611445982232488944558774612 * 390603545391089362063884922208143568023166603618446395589768 == 232210647056203049913662402532976186578842425262306016094292237500303028346593132411865381225871291702600263463125370016, |
| | 346 | ); |
| 329 | } | 347 | } |
| 330 | } | 348 | } |
| 331 | | 349 | |