Recursive example (Pow)

About Monkey 2 Forums Monkey 2 Code Library Recursive example (Pow)

This topic contains 4 replies, has 2 voices, and was last updated by  nerobot 5 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #14418

    SekaiChi
    Participant

    Short piece of code to show how to do Power recursively.

    #14424

    nerobot
    Participant

    Notes:

    -1*exp => -exp.

    Monkey2 already have Pow() function in monkey.math.

    🙂

    #14433

    SekaiChi
    Participant

    Ya I know it’s an example how to do recursive algorithms that I found intriguing while converting some game code. This one uses integer numbers instead of double also, it might be preferable sometimes.

    #14434

    SekaiChi
    Participant

    The -1 is just kept to maintain the symmetry, so you see how it works more easily.

    #14435

    nerobot
    Participant

    Cool!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.