-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added pow function fpm #1621
Added pow function fpm #1621
Conversation
Implemented a potential working version of pow using fixed point math. No way to test because project won't run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey thanks for the contribution, but your code still contains floating point math which is not what #1543 was about. What we want are fuctions that implement these operations by only using fixed-point arithmetic.
I don't know if you want to give this another try but we can't really use this code right now.
if (base == 0.0 && exponent == 0.0) { | ||
return openage::util::FixedPoint<I, F>::quiet_NaN(); // Undefined; return NaN | ||
} else if (base == 1.0 || exponent == 0.0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why compare to doubles in the if conditions when we could compre to fixed point values instead?
double log_base = std::log(base.get_raw_value()); | ||
double result = exponent * log_base; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pure fixed-point math functions should avoid any floating point arithmetic. Avoiding the floating point rounding erros is the point of using fp math after all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file would need to be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this one
I'm closing this because this is not what we are looking for. |
Implemented a potential working version of pow using fixed point math. No way to test because project won't run.