Skip to content

More math fixes/workarounds and unit tests #11

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

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

Conversation

kblaschke
Copy link
Member

Working together with @OfficialIncubo to get projectm-eval closer to the behavior of ns-eel2, this PR contains another set of fixes and workarounds to unbreak some presets relying on the fact that using math functions in the wrong way does not return NaN or Inf in some cases.

To make sure all functions and operators really work as expected, I've added unit tests for all functions which can be placed into the expression execution tree by the code compiler, including internal helpers like the expression list executor, variables and constants.

kblaschke and others added 8 commits July 7, 2025 23:48
the base is 0 and the exponential is negative.
Should be equivalent to ns-eel.
We want a no-op, just as in Milkdrop. Previously, freembuf() cleared the whole megabuf.
1. Fixed pow functions when it returns inf when the base is 0 and the exponential is negative.
2. Avoid log() and log10() function returning NaN or inf when it's 0.
3. Fixed pow_op, pow and invsqrt functions that intentionally returned NaN.
4. Removed sqr() cap. It's because of ns-eel2 adapts to 9 or 10 digits per value. Here is what it gives:
9999999 = 9999999
99999999 = 100000000
999999999 = 1000000000
9999999999 = 2147483648
10000000000 = 2147483648 (same gives it)
@kblaschke kblaschke self-assigned this Aug 1, 2025
@kblaschke kblaschke added the enhancement New feature or request label Aug 1, 2025
@revmischa revmischa requested a review from Copilot August 1, 2025 17:22
@kblaschke kblaschke review requested due to automatic review settings August 1, 2025 17:31
@kblaschke
Copy link
Member Author

kblaschke commented Aug 1, 2025

Dear lovely Copilot, I opened the PR and cannot review and approve it. Please stay away.

(Edit for clarification: Copilot seemingly tried to add me to the reviewers list, which didn't work too well because I'm the author of the PR)

@kblaschke kblaschke requested a review from revmischa August 3, 2025 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants