Skip to content

Comments

Fix NaN propagation in rc_sqrt and rc_log (mappers.cc) #46

Open
AADARSHPUROHIT466 wants to merge 4 commits intognu-octave:defaultfrom
AADARSHPUROHIT466:fix-nan-propagation
Open

Fix NaN propagation in rc_sqrt and rc_log (mappers.cc) #46
AADARSHPUROHIT466 wants to merge 4 commits intognu-octave:defaultfrom
AADARSHPUROHIT466:fix-nan-propagation

Conversation

@AADARSHPUROHIT466
Copy link
Contributor

These functions previously returned partial NaN values (NaN + 0i) when input was NaN.
This patch explicitly checks std::isnan(x) and returns Complex(x, x), ensuring both
real and imaginary parts propagate NaN consistently. Verified with test cases in Octave REPL:

rc_sqrt(NaN) -> NaN + NaNi
rc_log(NaN) -> NaN + NaN
i

@sonarqubecloud
Copy link

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