Skip to content

Conversation

@alaa-eddine
Copy link
Collaborator

Added

  • Math Namespace: Added math.todegrees and math.toradians functions. (contribution)

Fixed

  • Math Namespace: Fixed math.precision implementation and math.round precision parameter handling.
  • Variable Scope Collision: Fixed critical issue where local variables (var, let, const) in user-defined functions were sharing state across different function calls. Implemented dynamic scoping using unique call IDs to ensure each function instance maintains isolated state and history.
  • SMA NaN Handling: Improved ta.sma to correctly propagate NaN values and handle NaN contamination in the rolling window by falling back to full recalculation when necessary.
  • Transpiler Optimization: Major optimization of user-defined function transpilation. Introduced local context ($$) for scoping variables, reducing transpiled code complexity and improving readability by removing redundant _callId argument passing.
  • Array Access in Expressions: Fixed a bug in the transpiler where array access inside expressions (e.g. ternary operators) could use incorrect static scope keys.

alaa-eddine and others added 8 commits January 19, 2026 17:14
Fixed : SMA NaN handling
Fixed/Optimized transpiler
- Add optional precision parameter to math.round()
- math.round(2.01234, 2) now correctly returns 2.01
- Add test cases for precision parameter

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added : math.todegrees and math.toradians
@alaa-eddine alaa-eddine merged commit b2d206e into main Jan 24, 2026
1 check passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants