Skip to main content
Code Review

Return to Revisions

2 of 2
Use real superscripts and subscripts where possible
Toby Speight
  • 87.9k
  • 14
  • 104
  • 325

For exp not 0, between -1 and 1 it will make a recursive call with a negated exponent.

Furthermore x2n = (xn)2 which can be used to reduce n recursions down to log2(n) recursions.

For exp = n + q, n int, 0 < q < 1 or exp = n ± q, n int, 0 < q <= 0.5 you can use xexp = (xn).(xq). For the integer power n you can do the logarithmic recursion (double, long or BigInteger). For the q fraction you need an approximation sequence. Don't ask me how.

Underscore at the beginning, is extra. Nowadays the majority seems to find this less readable (as not a ubiquitous convention), and disruptive in reading. Less is more here.

Joop Eggen
  • 4.6k
  • 15
  • 19
default

AltStyle によって変換されたページ (->オリジナル) /