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

math: use libc wrappers for math.log2/1, math.log10/1, math.log1p/1 and math.log_b/1. Make assert math.log10(10) == 1.0 pass. #23129

Merged

Conversation

spytheman
Copy link
Member

@spytheman spytheman commented Dec 11, 2024

…nd math.log_b/1. Make `assert math.log10(10) == 1.0` pass.
@spytheman
Copy link
Member Author

assert math.log10(10.0) == 1.0 will pass on this PR by default now, because of the libc wrapper in log.c.v, but will still fail for ./v -exclude @vlib/math/*.c.v vlib/math/log_test.v.

That imho needs more investigation, by people with background in Numerical Analysis.

To me, it seems that the pure V approximation in https://github.com/vlang/v/blob/master/vlib/math/log.v#L122 may need tweaking of some consts, or an algorithmic adjustment.

@spytheman spytheman merged commit fdfb389 into vlang:master Dec 11, 2024
68 checks passed
@spytheman spytheman deleted the math_fix_log10_of_10_to_be_exactly_1 branch December 11, 2024 11:21
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.

1 participant