FixedMath.Net icon indicating copy to clipboard operation
FixedMath.Net copied to clipboard

Function Pow bug report

Open yunsile321 opened this issue 7 years ago • 1 comments

public static Fix64 Pow(Fix64 b, Fix64 exp) if b is negative, Log2 will Throw exception. bool isNeg = false; if (b.m_rawValue < 0) { isNeg = true; } Fix64 log2 = isNeg ? Log2(-b) : Log2(b);

yunsile321 avatar Apr 17 '18 03:04 yunsile321

Well at least it's documented :P

/// <exception cref="ArgumentOutOfRangeException">
/// The base was negative, with a non-zero exponent
/// </exception>

And the tests even validate that behavior. Which obviously is incorrect. It would be easy to implement by identity (a^-b = 1 / a^b), but fixing the test is more tricky. The way significant digits are validated right now is not clean.

asik avatar Apr 19 '18 17:04 asik