You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For issue #24119.
Resolves#24125.
This PR adds overloads to AutoMath to implement `param` versions of:
* `abs` for all numeric types
* `sqrt` for floating-point types.
Additionally, while testing, I realized that `complex.re` and
`complex.im` did not have `param` returning versions, so this PR also
adds such param-returning versions to ChapelBase.
To implement these, I:
* added `PRIM_SQRT` and `PRIM_ABS`. For now, these are just used for
computing these functions on `param`s and they will cause the compiler
to error out one makes it to code-generation time.
* implemented folding for `PRIM_ABS`, `PRIM_SQRT`, `PRIM_GET_REAL`, and
`PRIM_GET_IMAG` in num.cpp
* enabled `postFoldPrimop` to fold `PRIM_ABS`, `PRIM_SQRT`,
`PRIM_GET_REAL`, and `PRIM_GET_IMAG`
This PR also updates the spec description of `complex` to make it
clearer. While there, it removes `proc complex.bits` from the spec,
since this method does not exist other than in the spec.
Reviewed by @DanilaFe - thanks!
- [x] full comm=none testing
Future Work:
* #22809
* in particular, resolve two confusing errors I posted as comments based
on work on this PR
* update the dyno resolver to assert `PRIM_ABS`, `PRIM_SQRT` are only
used on `param` values
* update the dyno resolver to implement `PRIM_GET_REAL` and
`PRIM_GET_IMAG` on `param` values
Summary of Problem
abs
on a param complex number does not produce a param, but I would expect it to.In order to implement this, we will a need param-time
sqrt
forreal
numbers. That should also be available to users.Steps to Reproduce
Source Code:
Associated Future Test(s):
test/library/standard/AutoMath/absparamscomplex.chpl
#24127The text was updated successfully, but these errors were encountered: