WeBWorK Problems

extracting mantissa and exponent from float values?

Re: extracting mantissa and exponent from float values?

by Danny Glin -
Number of replies: 0
The following should do the basics of what you want.  It would need to be fixed to handle negative values, or to handle negative exponents properly, but it should give you a starting point:
$exp_k = int(ln($a)/ln(10));
$mant_k = $a/10**$exp_a;