Average Error: 0.0 → 0.2
Time: 2.8s
Precision: 64
\[e^{re} \cdot \sin im\]
\[\mathsf{expm1}\left(\mathsf{log1p}\left(e^{re} \cdot \sin im\right)\right)\]
e^{re} \cdot \sin im
\mathsf{expm1}\left(\mathsf{log1p}\left(e^{re} \cdot \sin im\right)\right)
double code(double re, double im) {
	return (exp(re) * sin(im));
}
double code(double re, double im) {
	return expm1(log1p((exp(re) * sin(im))));
}

Error

Bits error versus re

Bits error versus im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[e^{re} \cdot \sin im\]
  2. Using strategy rm
  3. Applied expm1-log1p-u0.2

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(e^{re} \cdot \sin im\right)\right)}\]
  4. Final simplification0.2

    \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(e^{re} \cdot \sin im\right)\right)\]

Reproduce

herbie shell --seed 2020091 +o rules:numerics
(FPCore (re im)
  :name "math.exp on complex, imaginary part"
  :precision binary64
  (* (exp re) (sin im)))