Exponentiation (beginner)

Share your advanced PureBasic knowledge/code with the community.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Exponentiation (beginner)

Post by Trond »

If you need to do something like Pow() but with larger numbers than you can a float can hold, you can use this macro:

Code: Select all

Macro ExpLtoQ(b, e)
  res64.q = 1
  For i.l = 0 To e-1
    res64*b
  Next
EndMacro
It's not absolutely fast, but it's does work.