Oh, sorry i missed the link, i [updated][1] it
[1]: http://jsfiddle.net/ehatwwL2/1/Continuing the discussion from Breaking down a long math calculation:
then this function should already give you the correct APR.
it does, but it gives me something like e.g 5.58976.0 and even long. I applied toFixed() event too as @Paul_Wilkins mentioned. yet it gives me pretty long APR. which is wrong.