Average Error: 0.0 → 0.0
Time: 12.4s
Precision: binary64
\[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
\[\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \sqrt{0.5} \cdot \frac{\sqrt{0.5}}{e^{im}}\right) \]
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \sqrt{0.5} \cdot \frac{\sqrt{0.5}}{e^{im}}\right)
(FPCore (re im)
 :precision binary64
 (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))
(FPCore (re im)
 :precision binary64
 (* (sin re) (fma 0.5 (exp im) (* (sqrt 0.5) (/ (sqrt 0.5) (exp im))))))
double code(double re, double im) {
	return (0.5 * sin(re)) * (exp(0.0 - im) + exp(im));
}
double code(double re, double im) {
	return sin(re) * fma(0.5, exp(im), (sqrt(0.5) * (sqrt(0.5) / exp(im))));
}

Error

Bits error versus re

Bits error versus im

Derivation

  1. Initial program 0.0

    \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
  2. Simplified0.0

    \[\leadsto \color{blue}{\sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)} \]
  3. Applied *-un-lft-identity_binary640.0

    \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{\color{blue}{1 \cdot e^{im}}}\right) \]
  4. Applied add-sqr-sqrt_binary640.0

    \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{\color{blue}{\sqrt{0.5} \cdot \sqrt{0.5}}}{1 \cdot e^{im}}\right) \]
  5. Applied times-frac_binary640.0

    \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\frac{\sqrt{0.5}}{1} \cdot \frac{\sqrt{0.5}}{e^{im}}}\right) \]
  6. Simplified0.0

    \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \color{blue}{\sqrt{0.5}} \cdot \frac{\sqrt{0.5}}{e^{im}}\right) \]
  7. Final simplification0.0

    \[\leadsto \sin re \cdot \mathsf{fma}\left(0.5, e^{im}, \sqrt{0.5} \cdot \frac{\sqrt{0.5}}{e^{im}}\right) \]

Reproduce

herbie shell --seed 2021215 
(FPCore (re im)
  :name "math.sin on complex, real part"
  :precision binary64
  (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))