Skip to content
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

Improve accuracy of various functions in edge cases #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mb64
Copy link

@mb64 mb64 commented Jul 10, 2018

Fixes #2.

Some of the approximations yielded crazy answers for inputs that they weren't designed to deal with, such as ln giving 10^40 for inputs near 0.3 (the real answer is about -1.2).

This fixes it simply, by adding if statements and transforming it to numbers in the reasonable domain of the approximations. For ln, for example, it computes the log of numbers less than 1 by doing -ln(1/x).

Not all the functions are modified; just the ones I needed to fix edge cases for to use.

Here's my reasoning behind what I changed:

  • I graphed all the things I was using, and modified the ones that looked incorrect to be better
  • Using these modifications made the test suite for the palette crate pass when it didn't before
  • The mish test suite results have not changed

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

Successfully merging this pull request may close these issues.

powf returns NaN for small bases
1 participant