Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Function Pow bug report #17

Open
yunsile321 opened this issue Apr 17, 2018 · 1 comment
Open

Function Pow bug report #17

yunsile321 opened this issue Apr 17, 2018 · 1 comment

Comments

@yunsile321
Copy link

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);

@asik
Copy link
Owner

asik commented Apr 19, 2018

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants