Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // SmallNumbersApproxPowScalarExp()
- //
- //! x > 0, y >= 0 !
- //
- //*********************************************************************************************
- static inline float SmallNumbersApproxPowScalarExp(float x, float y)
- {
- // Based on algorithm by NN Schraudolph described here: "A Fast, Compact Approximation of the Exponential Function"
- // https://nic.schraudolph.org/pubs/Schraudolph99.pdf
- static constexpr int32 CONST = 127 * (1 << 23) - 298765;
- return UIntAsFloat(FloorToInt(y * (FloatAsInt(x + 0.0000001f) - CONST) + CONST));
- }
- //*********************************************************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement