Skip to content

Conversation

@ChrisRackauckas
Copy link
Member

NaNMath does not handle integer dispatches. This fixes it so that a wrapper function handles the integer dispatch, restoring the behavior of ^

NaNMath does not handle integer dispatches. This fixes it so that a wrapper function handles the integer dispatch, restoring the behavior of ^
Copy link
Contributor

@devmotion devmotion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed the Int problem as well. Wouldn't it be easier to just never rewrite ^ to NaNMath.pow if args[2] isa Int? There shouldn't be any numerical issues anyway in this case.

Co-authored-by: David Widmann <[email protected]>
@ChrisRackauckas
Copy link
Member Author

In theory everyone's symbolic types should match the types they end up passing to the function. In practice I think it's more robust to not assume that, and since it's practically zero overhead to not assume that (since this dispatch should compile out in almost all cases of symbolic generated functions), I would take the more robust route.

@devmotion
Copy link
Contributor

On a second thought, I guess we should just add pow(x::Real, y::Int) = x^y to NaNMath?

@devmotion
Copy link
Contributor

I opened JuliaMath/NaNMath.jl#83.

@ChrisRackauckas
Copy link
Member Author

Yeah that's a more general solution.

@ChrisRackauckas ChrisRackauckas deleted the pow branch January 9, 2025 08:12
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.

3 participants