Home » News & Blogs » How much does a square root cost?
Bookmark and Share
Exploding Galaxies and other Catastrophysics

How much does a square root cost?

11 Jul 2014, 23:30 UTC
How much does a square root cost?
(200 words excerpt, click title or image to see full post)

An interesting diversion: how much (time) does calling the square root function sqrt() cost, and is it even worth trying alternative less-accurate implementations?Some Assembly Required provides some answers: SQUARE ROOTMethodTotal timeTime per floatAvg ErrorCompiler sqrt(x) /x87 FPU FSQRT404.029ms24ns0.0000%SSE intrinsic ssqrts200.395ms11.9ns0.0000%Carmack’s Magic Number rsqrt * x72.682ms4.33ns0.0990%SSE rsqrtss * x20.495ms1.22ns0.0094%SSE rsqrtss * xwith one NR step53.401ms3.18ns0.0000%SSE rsqrtss * xwith one NR step, unrolled by four48.701ms2.90ns0.0000%RECIPROCAL SQRTMethodTotal timeTime per floatAvg ErrorCarmack’s Magic Number rsqrt 59.378ms3.54ns0.0990%SSE rsqrtss14.202ms0.85ns0.0094%SSE rsqrtss with one NR step45.952ms2.74ns0.0000%

Latest Vodcast

Latest Podcast

Advertise PTTU

NASA Picture of the Day

Astronomy Picture of the Day

astronomy_pod