Average Error: 0.0 → 0.0
Time: 9.5s
Precision: binary64
Cost: 12992
\[e^{re} \cdot \cos im \]
\[e^{re} \cdot \cos im \]
(FPCore (re im) :precision binary64 (* (exp re) (cos im)))
(FPCore (re im) :precision binary64 (* (exp re) (cos im)))
double code(double re, double im) {
	return exp(re) * cos(im);
}
double code(double re, double im) {
	return exp(re) * cos(im);
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    code = exp(re) * cos(im)
end function
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    code = exp(re) * cos(im)
end function
public static double code(double re, double im) {
	return Math.exp(re) * Math.cos(im);
}
public static double code(double re, double im) {
	return Math.exp(re) * Math.cos(im);
}
def code(re, im):
	return math.exp(re) * math.cos(im)
def code(re, im):
	return math.exp(re) * math.cos(im)
function code(re, im)
	return Float64(exp(re) * cos(im))
end
function code(re, im)
	return Float64(exp(re) * cos(im))
end
function tmp = code(re, im)
	tmp = exp(re) * cos(im);
end
function tmp = code(re, im)
	tmp = exp(re) * cos(im);
end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
e^{re} \cdot \cos im
e^{re} \cdot \cos im

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[e^{re} \cdot \cos im \]
  2. Final simplification0.0

    \[\leadsto e^{re} \cdot \cos im \]

Alternatives

Alternative 1
Error0.6
Cost13636
\[\begin{array}{l} \mathbf{if}\;e^{re} \leq 10^{-8}:\\ \;\;\;\;e^{re}\\ \mathbf{else}:\\ \;\;\;\;\cos im \cdot \left(\left(re + 1\right) + 0.5 \cdot \left(re \cdot re\right)\right)\\ \end{array} \]
Alternative 2
Error0.8
Cost13252
\[\begin{array}{l} \mathbf{if}\;e^{re} \leq 10^{-8}:\\ \;\;\;\;e^{re}\\ \mathbf{else}:\\ \;\;\;\;\cos im \cdot \left(re + 1\right)\\ \end{array} \]
Alternative 3
Error1.3
Cost12996
\[\begin{array}{l} \mathbf{if}\;e^{re} \leq 10^{-8}:\\ \;\;\;\;e^{re}\\ \mathbf{else}:\\ \;\;\;\;\cos im\\ \end{array} \]
Alternative 4
Error1.7
Cost6728
\[\begin{array}{l} t_0 := \left(re + -1\right) + \left(re \cdot re\right) \cdot -0.5\\ \mathbf{if}\;re \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{-1}{t_0}\\ \mathbf{elif}\;re \leq -9.5 \cdot 10^{-9}:\\ \;\;\;\;\frac{re \cdot re + \left(-1 - re \cdot re\right)}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\cos im\\ \end{array} \]
Alternative 5
Error20.1
Cost1348
\[\begin{array}{l} t_0 := \left(re + -1\right) + \left(re \cdot re\right) \cdot -0.5\\ \mathbf{if}\;re \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{-1}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{re \cdot re + \left(-1 - re \cdot re\right)}{t_0}\\ \end{array} \]
Alternative 6
Error29.4
Cost704
\[\frac{-1}{\left(re + -1\right) + \left(re \cdot re\right) \cdot -0.5} \]
Alternative 7
Error40.6
Cost64
\[1 \]

Error

Reproduce

herbie shell --seed 2022340 
(FPCore (re im)
  :name "math.exp on complex, real part"
  :precision binary64
  (* (exp re) (cos im)))