Fast exponentiation using binary

Поділитися
Вставка
  • Опубліковано 13 гру 2024

КОМЕНТАРІ • 4

  • @Coco-hi2sz
    @Coco-hi2sz Місяць тому +2

    If you are interested in the subject and do not know it yet.
    I recommend you to learn about fast inverse square root, it's really impressive.

    • @cacharle
      @cacharle  Місяць тому +2

      Yes, I think I used that algorithm in some of my projects (without understanding it 😅) but I'll fully learn it next time I need it. And there is a famous yt video "quake fast inverse square root" or smth about it aswell.

  • @Vitis-n2v
    @Vitis-n2v Місяць тому

    Does the math pow() function also use this approach or is there even better solution?

    • @cacharle
      @cacharle  Місяць тому +1

      Good question, quickly looking at the pow() function implementation of muslibc, it is waaaayy more complex than my implementation (theirs is ~350 lines long 😅) but they are dealing with floating point numbers instead of integers so I'm sure a lot of the complexity comes from there.