itt-ustutt / num-dual

Generalized (hyper-) dual numbers in rust
Apache License 2.0
60 stars 7 forks source link

Implement atan2 and copysign for dual numbers #66

Closed prehner closed 1 year ago

prehner commented 1 year ago

This adds the two missing implementations from the nalgebra::RealField trait.

atan2 is implemented according to the suggestion of @tsmith023. The conventions that cause y.atan2(x) to not always be identical to (y/x).atan() are irrelevant for the derivative. Therefore, no separate cases need to be considered.

copysign is implemented exactly as the docstring in the trait suggests.

closes #61