Skip to content

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
spytheman merged 1 commit intovlang:masterfrom
spytheman:math_fix_log10_of_10_to_be_exactly_1
Dec 11, 2024
Merged

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
spytheman merged 1 commit intovlang:masterfrom
spytheman:math_fix_log10_of_10_to_be_exactly_1

Conversation

@spytheman
Copy link
Copy Markdown
Contributor

@spytheman spytheman commented Dec 11, 2024

…nd math.log_b/1. Make `assert math.log10(10) == 1.0` pass.
@spytheman
Copy link
Copy Markdown
Contributor 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.

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