lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



If a is non-negative:
1) Do float calculation, as usual: result = a^b
2) If result is less that 2^53, then convert it to integer and return integer result
3) If result is above 2^63, then return float result
4) Recalculate the result using integer multiplication and return it


On step 2 float number should be rounded to nearest integer, so it would be better to have some spare precision:
2) If result is less that 2^50, then return nearest integer to result