Forum > General

Frexp() doesn't work for me

(1/2) > >>

Ruptor:
I pass Frexp  30800024238.61462 and it returns
mantissa = 0.89639868350392848
exponent = 35
Am I doing something stupid?
Running Win XP Laz 1.4.4 FPC 2.6.4  SVN 49931

Laksen:
0.89639868350392848*(1+2^35)=30800024239.511018756

Ruptor:
OK base 2 so how can I get
mantissa= 3.080002423861462
exponent= 10

Jonas Maebe:

--- Quote from: Ruptor on October 12, 2015, 02:37:40 am ---OK base 2 so how can I get
mantissa= 3.080002423861462
exponent= 10

--- End quote ---

http://www.rapidtables.com/math/algebra/logarithm/Logarithm_Base_Change.htm

Ruptor:
Thanks Jonas. I thought of changing the base this morning but I only wanted to know how far a number was over a million so I just did this
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---while root>1000000 do root:=root/10;Probably not as efficient as changing base but it doesn't need the math unit and suits my purpose.
The main problem for an amateur high level programmer like me is that Frexp doesn't say it is giving base 2 results and I didn't twig it hence my confusion