1
$\begingroup$

I have written a math library which handles really big numbers with good precision. Each digit is stored in a nibble and a 'nibble array' makes up the number. There is no epsilon portion, as for currency calculation big brother is happy enough to loose penny fractions with int like rounding.

My problem is $a^b$ . It's all ok if $b$ is an integer value, but what if it has decimal digits.

But how to calculate $4.613765^{3.14259}$ from first principles. It's so long since I did a-level math I don't know where to begin.

How to calculate $a^b$ when $b$ is not an integer?

$\endgroup$
  • $\begingroup$ Since both are rational numbers, you can write them on the form of $\frac{a}{b}^{\frac{n}{m}} = (\sqrt[m]{\frac{a}{b}})^n$. Or in your case, if you'd like to compute $4.6^{22/7}$, you can rewrite to $(\sqrt[7]{4.6})^{22}$. Of course, I don't really know how to compute $\sqrt[7]{4.6}$ exactly, so I'm not sure this is in the right direction ... $\endgroup$ – Pål GD May 3 '15 at 9:21
  • $\begingroup$ @PålGD I can do sqrt by liner interpolation. What do operators prefix\ and a number in set brackets{ }. I'm guessing fraction is the digits after the decimal point. What's $ about $\endgroup$ – rhubarbdog May 3 '15 at 9:51
  • $\begingroup$ @rhubarbdog That's LaTeX; if you enable scripts here (and other SE sites), in particular those from mathjax.org, you'll see rendered mathematics. (Of course, the Android app can't do it; better use a browser for math-heavy SE sites.) $\endgroup$ – Raphael May 3 '15 at 9:55
  • $\begingroup$ @PålGD's comment without the mathematical mark-up is: "Since both are rational numbers, you can write them in the form of (a/b)^(n/m) = (mth root of a/b)^n. Or in your case, if you'd like to compute 4.6^(22/7), you can rewrite to (7th root of 4.6)^22. Of course, I don't really know how to compute the seventh root of 4.6 exactly so I'm not sure this is in the right direction." $\endgroup$ – David Richerby May 3 '15 at 10:01
  • $\begingroup$ @DavidRicherby I may have thrown a curved ball here. I want this to work for any a and any b. I should not have used a pi approximation as on of the terms, as for the other number (a) sorry if that also has 'magic' properties. $\endgroup$ – rhubarbdog May 3 '15 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.