goostengine / goost

A general-purpose, extensible and customizable C++ extension for Godot Engine.
https://goostengine.github.io/
MIT License
481 stars 18 forks source link

Add logarithmic functions #155

Closed Xrayez closed 3 years ago

Xrayez commented 3 years ago

Adds log2, log10, and log with ability to compute logarithm with arbitrary base.

For instance, I've come up with a way to calculate number of trials in order to achieve some success rate for some probability event via script, which requires finding x in:

func trials_until_success(event_probability, success_rate = 0.99):
    return GoostMath.log(1.0 - success_rate, 1.0 - event_probability)