Advertisement
Oysi

sqrt test

Jul 12th, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.36 KB | None | 0 0
  1. local sqrt = math.sqrt
  2.  
  3. local it = 1000000
  4.  
  5. local t = os.clock()
  6. for i = 1, it do
  7.     local x = math.sqrt(i)
  8. end
  9. print("math.sqrt(x): " .. os.clock() - t)
  10.  
  11. local t = os.clock()
  12. for i = 1, it do
  13.     local x = sqrt(i)
  14. end
  15. print("sqrt(x): " .. os.clock() - t)
  16.  
  17. local t = os.clock()
  18. for i = 1, it do
  19.     local x = i^0.5
  20. end
  21. print("x^0.5: " .. os.clock() - t)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement