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

Replace 1/sqrt(2*pi) calculations with constants #28

Merged
merged 4 commits into from
May 26, 2024

Conversation

sunsided
Copy link
Contributor

@sunsided sunsided commented May 26, 2024

This changes some function calls to avoid divisions and replace them with constants.


This PR also includes #27 for use of black_box in benchmarks. Compared to that I get slighly reduced mean durations with improved error bounds:

running 3 tests
test bench_all_price          ... bench:          57.02 ns/iter (+/- 3.87)
test bench_all_price_no_cache ... bench:         235.70 ns/iter (+/- 64.07)
test bench_call_price         ... bench:          38.98 ns/iter (+/- 6.24)

Like in #27, the benchmark test will also fail here due to the changed duration baselines.

@sunsided sunsided force-pushed the feature/constants branch from 33145cd to e69debd Compare May 26, 2024 12:41
@sunsided sunsided marked this pull request as ready for review May 26, 2024 12:43
@coveralls
Copy link

coveralls commented May 26, 2024

Pull Request Test Coverage Report for Build 9243534858

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 8 of 8 (100.0%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.6%) to 79.967%

Files with Coverage Reduction New Missed Lines %
src/lib.rs 1 79.97%
Totals Coverage Status
Change from base Build 4354937295: -0.6%
Covered Lines: 407
Relevant Lines: 446

💛 - Coveralls

@danielhstahl
Copy link
Owner

Thank you, can you bump https://github.com/danielhstahl/black_scholes_rust/blob/master/Cargo.toml#L3 to 10.2?

@sunsided
Copy link
Contributor Author

Done!

@danielhstahl danielhstahl merged commit 8d239d9 into danielhstahl:master May 26, 2024
5 of 6 checks passed
@sunsided sunsided deleted the feature/constants branch May 26, 2024 13:30
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.

3 participants