Average Error: 0.0 → 0.0
Time: 27.4s
Precision: 64
\[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)\]
\[0.5 \cdot \mathsf{fma}\left(\left(\sin re\right), \left(e^{im}\right), \left(\frac{\sin re}{e^{im}}\right)\right)\]
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
0.5 \cdot \mathsf{fma}\left(\left(\sin re\right), \left(e^{im}\right), \left(\frac{\sin re}{e^{im}}\right)\right)
double f(double re, double im) {
        double r767821 = 0.5;
        double r767822 = re;
        double r767823 = sin(r767822);
        double r767824 = r767821 * r767823;
        double r767825 = 0.0;
        double r767826 = im;
        double r767827 = r767825 - r767826;
        double r767828 = exp(r767827);
        double r767829 = exp(r767826);
        double r767830 = r767828 + r767829;
        double r767831 = r767824 * r767830;
        return r767831;
}

double f(double re, double im) {
        double r767832 = 0.5;
        double r767833 = re;
        double r767834 = sin(r767833);
        double r767835 = im;
        double r767836 = exp(r767835);
        double r767837 = r767834 / r767836;
        double r767838 = fma(r767834, r767836, r767837);
        double r767839 = r767832 * r767838;
        return r767839;
}

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}{0.5 \cdot \mathsf{fma}\left(\left(\sin re\right), \left(e^{im}\right), \left(\frac{\sin re}{e^{im}}\right)\right)}\]
  3. Final simplification0.0

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

Reproduce

herbie shell --seed 2019124 +o rules:numerics
(FPCore (re im)
  :name "math.sin on complex, real part"
  (* (* 0.5 (sin re)) (+ (exp (- 0 im)) (exp im))))