Average Error: 0.0 → 0.1
Time: 9.5s
Precision: binary64
Cost: 72000
\[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
\[\begin{array}{l} t_0 := e^{-im}\\ \left(0.5 \cdot \sin re\right) \cdot \frac{{t_0}^{3} + {\left(e^{im}\right)}^{3}}{t_0 \cdot t_0 + \left(e^{im} \cdot e^{im} - t_0 \cdot e^{im}\right)} \end{array} \]
(FPCore (re im)
 :precision binary64
 (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (exp (- im))))
   (*
    (* 0.5 (sin re))
    (/
     (+ (pow t_0 3.0) (pow (exp im) 3.0))
     (+ (* t_0 t_0) (- (* (exp im) (exp im)) (* t_0 (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) {
	double t_0 = exp(-im);
	return (0.5 * sin(re)) * ((pow(t_0, 3.0) + pow(exp(im), 3.0)) / ((t_0 * t_0) + ((exp(im) * exp(im)) - (t_0 * exp(im)))));
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    code = (0.5d0 * sin(re)) * (exp((0.0d0 - im)) + exp(im))
end function
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    real(8) :: t_0
    t_0 = exp(-im)
    code = (0.5d0 * sin(re)) * (((t_0 ** 3.0d0) + (exp(im) ** 3.0d0)) / ((t_0 * t_0) + ((exp(im) * exp(im)) - (t_0 * exp(im)))))
end function
public static double code(double re, double im) {
	return (0.5 * Math.sin(re)) * (Math.exp((0.0 - im)) + Math.exp(im));
}
public static double code(double re, double im) {
	double t_0 = Math.exp(-im);
	return (0.5 * Math.sin(re)) * ((Math.pow(t_0, 3.0) + Math.pow(Math.exp(im), 3.0)) / ((t_0 * t_0) + ((Math.exp(im) * Math.exp(im)) - (t_0 * Math.exp(im)))));
}
def code(re, im):
	return (0.5 * math.sin(re)) * (math.exp((0.0 - im)) + math.exp(im))
def code(re, im):
	t_0 = math.exp(-im)
	return (0.5 * math.sin(re)) * ((math.pow(t_0, 3.0) + math.pow(math.exp(im), 3.0)) / ((t_0 * t_0) + ((math.exp(im) * math.exp(im)) - (t_0 * math.exp(im)))))
function code(re, im)
	return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(0.0 - im)) + exp(im)))
end
function code(re, im)
	t_0 = exp(Float64(-im))
	return Float64(Float64(0.5 * sin(re)) * Float64(Float64((t_0 ^ 3.0) + (exp(im) ^ 3.0)) / Float64(Float64(t_0 * t_0) + Float64(Float64(exp(im) * exp(im)) - Float64(t_0 * exp(im))))))
end
function tmp = code(re, im)
	tmp = (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im));
end
function tmp = code(re, im)
	t_0 = exp(-im);
	tmp = (0.5 * sin(re)) * (((t_0 ^ 3.0) + (exp(im) ^ 3.0)) / ((t_0 * t_0) + ((exp(im) * exp(im)) - (t_0 * exp(im)))));
end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[re_, im_] := Block[{t$95$0 = N[Exp[(-im)], $MachinePrecision]}, N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[t$95$0, 3.0], $MachinePrecision] + N[Power[N[Exp[im], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] / N[(N[(t$95$0 * t$95$0), $MachinePrecision] + N[(N[(N[Exp[im], $MachinePrecision] * N[Exp[im], $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\begin{array}{l}
t_0 := e^{-im}\\
\left(0.5 \cdot \sin re\right) \cdot \frac{{t_0}^{3} + {\left(e^{im}\right)}^{3}}{t_0 \cdot t_0 + \left(e^{im} \cdot e^{im} - t_0 \cdot e^{im}\right)}
\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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}{\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right)} \]
    Proof
    (*.f64 (*.f64 1/2 (sin.f64 re)) (+.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))): 0 points increase in error, 0 points decrease in error
    (*.f64 (*.f64 1/2 (sin.f64 re)) (+.f64 (exp.f64 (Rewrite<= sub0-neg_binary64 (-.f64 0 im))) (exp.f64 im))): 0 points increase in error, 0 points decrease in error
  3. Applied egg-rr0.1

    \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\frac{{\left(e^{-im}\right)}^{3} + {\left(e^{im}\right)}^{3}}{e^{-im} \cdot e^{-im} + \left(e^{im} \cdot e^{im} - e^{-im} \cdot e^{im}\right)}} \]
  4. Final simplification0.1

    \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \frac{{\left(e^{-im}\right)}^{3} + {\left(e^{im}\right)}^{3}}{e^{-im} \cdot e^{-im} + \left(e^{im} \cdot e^{im} - e^{-im} \cdot e^{im}\right)} \]

Alternatives

Alternative 1
Error0.0
Cost26368
\[\begin{array}{l} t_0 := 0.5 \cdot \sin re\\ t_0 \cdot e^{-im} + t_0 \cdot e^{im} \end{array} \]
Alternative 2
Error0.0
Cost19712
\[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right) \]
Alternative 3
Error0.6
Cost7616
\[\left(0.5 \cdot \sin re\right) \cdot \left(2 + \left(im \cdot im + \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot 0.08333333333333333\right)\right) \]
Alternative 4
Error0.7
Cost6976
\[\sin re \cdot \left(0.5 \cdot \left(im \cdot im\right) + 1\right) \]
Alternative 5
Error1.1
Cost6464
\[\sin re \]
Alternative 6
Error31.2
Cost576
\[\left(2 + im \cdot im\right) \cdot \left(0.5 \cdot re\right) \]
Alternative 7
Error31.4
Cost64
\[re \]

Error

Reproduce

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