
(FPCore (re im) :precision binary64 (* (exp re) (sin im)))
double code(double re, double im) {
return exp(re) * sin(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * sin(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.sin(im);
}
def code(re, im): return math.exp(re) * math.sin(im)
function code(re, im) return Float64(exp(re) * sin(im)) end
function tmp = code(re, im) tmp = exp(re) * sin(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \sin im
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (exp re) (sin im)))
double code(double re, double im) {
return exp(re) * sin(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * sin(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.sin(im);
}
def code(re, im): return math.exp(re) * math.sin(im)
function code(re, im) return Float64(exp(re) * sin(im)) end
function tmp = code(re, im) tmp = exp(re) * sin(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \sin im
\end{array}
(FPCore (re im) :precision binary64 (* (exp re) (sin im)))
double code(double re, double im) {
return exp(re) * sin(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * sin(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.sin(im);
}
def code(re, im): return math.exp(re) * math.sin(im)
function code(re, im) return Float64(exp(re) * sin(im)) end
function tmp = code(re, im) tmp = exp(re) * sin(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \sin im
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (re im) :precision binary64 (if (or (<= (exp re) 0.9999998) (not (<= (exp re) 2.0))) (* (exp re) im) (sin im)))
double code(double re, double im) {
double tmp;
if ((exp(re) <= 0.9999998) || !(exp(re) <= 2.0)) {
tmp = exp(re) * im;
} else {
tmp = sin(im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((exp(re) <= 0.9999998d0) .or. (.not. (exp(re) <= 2.0d0))) then
tmp = exp(re) * im
else
tmp = sin(im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((Math.exp(re) <= 0.9999998) || !(Math.exp(re) <= 2.0)) {
tmp = Math.exp(re) * im;
} else {
tmp = Math.sin(im);
}
return tmp;
}
def code(re, im): tmp = 0 if (math.exp(re) <= 0.9999998) or not (math.exp(re) <= 2.0): tmp = math.exp(re) * im else: tmp = math.sin(im) return tmp
function code(re, im) tmp = 0.0 if ((exp(re) <= 0.9999998) || !(exp(re) <= 2.0)) tmp = Float64(exp(re) * im); else tmp = sin(im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((exp(re) <= 0.9999998) || ~((exp(re) <= 2.0))) tmp = exp(re) * im; else tmp = sin(im); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[N[Exp[re], $MachinePrecision], 0.9999998], N[Not[LessEqual[N[Exp[re], $MachinePrecision], 2.0]], $MachinePrecision]], N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision], N[Sin[im], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0.9999998 \lor \neg \left(e^{re} \leq 2\right):\\
\;\;\;\;e^{re} \cdot im\\
\mathbf{else}:\\
\;\;\;\;\sin im\\
\end{array}
\end{array}
if (exp.f64 re) < 0.999999799999999994 or 2 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0 91.3%
if 0.999999799999999994 < (exp.f64 re) < 2Initial program 100.0%
Taylor expanded in re around 0 99.6%
Final simplification95.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) im)))
(if (<= re -0.00255)
t_0
(if (<= re 0.0135)
(* (sin im) (+ (+ re 1.0) (* re (* re 0.5))))
(if (<= re 1e+103)
t_0
(*
(sin im)
(+ (+ re 1.0) (* (* re re) (+ 0.5 (* re 0.16666666666666666))))))))))
double code(double re, double im) {
double t_0 = exp(re) * im;
double tmp;
if (re <= -0.00255) {
tmp = t_0;
} else if (re <= 0.0135) {
tmp = sin(im) * ((re + 1.0) + (re * (re * 0.5)));
} else if (re <= 1e+103) {
tmp = t_0;
} else {
tmp = sin(im) * ((re + 1.0) + ((re * re) * (0.5 + (re * 0.16666666666666666))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = exp(re) * im
if (re <= (-0.00255d0)) then
tmp = t_0
else if (re <= 0.0135d0) then
tmp = sin(im) * ((re + 1.0d0) + (re * (re * 0.5d0)))
else if (re <= 1d+103) then
tmp = t_0
else
tmp = sin(im) * ((re + 1.0d0) + ((re * re) * (0.5d0 + (re * 0.16666666666666666d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.exp(re) * im;
double tmp;
if (re <= -0.00255) {
tmp = t_0;
} else if (re <= 0.0135) {
tmp = Math.sin(im) * ((re + 1.0) + (re * (re * 0.5)));
} else if (re <= 1e+103) {
tmp = t_0;
} else {
tmp = Math.sin(im) * ((re + 1.0) + ((re * re) * (0.5 + (re * 0.16666666666666666))));
}
return tmp;
}
def code(re, im): t_0 = math.exp(re) * im tmp = 0 if re <= -0.00255: tmp = t_0 elif re <= 0.0135: tmp = math.sin(im) * ((re + 1.0) + (re * (re * 0.5))) elif re <= 1e+103: tmp = t_0 else: tmp = math.sin(im) * ((re + 1.0) + ((re * re) * (0.5 + (re * 0.16666666666666666)))) return tmp
function code(re, im) t_0 = Float64(exp(re) * im) tmp = 0.0 if (re <= -0.00255) tmp = t_0; elseif (re <= 0.0135) tmp = Float64(sin(im) * Float64(Float64(re + 1.0) + Float64(re * Float64(re * 0.5)))); elseif (re <= 1e+103) tmp = t_0; else tmp = Float64(sin(im) * Float64(Float64(re + 1.0) + Float64(Float64(re * re) * Float64(0.5 + Float64(re * 0.16666666666666666))))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(re) * im; tmp = 0.0; if (re <= -0.00255) tmp = t_0; elseif (re <= 0.0135) tmp = sin(im) * ((re + 1.0) + (re * (re * 0.5))); elseif (re <= 1e+103) tmp = t_0; else tmp = sin(im) * ((re + 1.0) + ((re * re) * (0.5 + (re * 0.16666666666666666)))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision]}, If[LessEqual[re, -0.00255], t$95$0, If[LessEqual[re, 0.0135], N[(N[Sin[im], $MachinePrecision] * N[(N[(re + 1.0), $MachinePrecision] + N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1e+103], t$95$0, N[(N[Sin[im], $MachinePrecision] * N[(N[(re + 1.0), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot im\\
\mathbf{if}\;re \leq -0.00255:\\
\;\;\;\;t_0\\
\mathbf{elif}\;re \leq 0.0135:\\
\;\;\;\;\sin im \cdot \left(\left(re + 1\right) + re \cdot \left(re \cdot 0.5\right)\right)\\
\mathbf{elif}\;re \leq 10^{+103}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\sin im \cdot \left(\left(re + 1\right) + \left(re \cdot re\right) \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < -0.0025500000000000002 or 0.0134999999999999998 < re < 1e103Initial program 100.0%
Taylor expanded in im around 0 95.0%
if -0.0025500000000000002 < re < 0.0134999999999999998Initial program 100.0%
Taylor expanded in re around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
*-commutative100.0%
distribute-lft1-in100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
if 1e103 < re Initial program 100.0%
Taylor expanded in re around 0 100.0%
associate-+r+100.0%
*-commutative100.0%
distribute-rgt1-in100.0%
*-commutative100.0%
+-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Final simplification98.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* re 0.5))) (t_1 (* (exp re) im)))
(if (<= re -0.00255)
t_1
(if (<= re 0.028)
(* (sin im) (+ (+ re 1.0) t_0))
(if (<= re 1.9e+154) t_1 (* (sin im) t_0))))))
double code(double re, double im) {
double t_0 = re * (re * 0.5);
double t_1 = exp(re) * im;
double tmp;
if (re <= -0.00255) {
tmp = t_1;
} else if (re <= 0.028) {
tmp = sin(im) * ((re + 1.0) + t_0);
} else if (re <= 1.9e+154) {
tmp = t_1;
} else {
tmp = sin(im) * t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = re * (re * 0.5d0)
t_1 = exp(re) * im
if (re <= (-0.00255d0)) then
tmp = t_1
else if (re <= 0.028d0) then
tmp = sin(im) * ((re + 1.0d0) + t_0)
else if (re <= 1.9d+154) then
tmp = t_1
else
tmp = sin(im) * t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (re * 0.5);
double t_1 = Math.exp(re) * im;
double tmp;
if (re <= -0.00255) {
tmp = t_1;
} else if (re <= 0.028) {
tmp = Math.sin(im) * ((re + 1.0) + t_0);
} else if (re <= 1.9e+154) {
tmp = t_1;
} else {
tmp = Math.sin(im) * t_0;
}
return tmp;
}
def code(re, im): t_0 = re * (re * 0.5) t_1 = math.exp(re) * im tmp = 0 if re <= -0.00255: tmp = t_1 elif re <= 0.028: tmp = math.sin(im) * ((re + 1.0) + t_0) elif re <= 1.9e+154: tmp = t_1 else: tmp = math.sin(im) * t_0 return tmp
function code(re, im) t_0 = Float64(re * Float64(re * 0.5)) t_1 = Float64(exp(re) * im) tmp = 0.0 if (re <= -0.00255) tmp = t_1; elseif (re <= 0.028) tmp = Float64(sin(im) * Float64(Float64(re + 1.0) + t_0)); elseif (re <= 1.9e+154) tmp = t_1; else tmp = Float64(sin(im) * t_0); end return tmp end
function tmp_2 = code(re, im) t_0 = re * (re * 0.5); t_1 = exp(re) * im; tmp = 0.0; if (re <= -0.00255) tmp = t_1; elseif (re <= 0.028) tmp = sin(im) * ((re + 1.0) + t_0); elseif (re <= 1.9e+154) tmp = t_1; else tmp = sin(im) * t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision]}, If[LessEqual[re, -0.00255], t$95$1, If[LessEqual[re, 0.028], N[(N[Sin[im], $MachinePrecision] * N[(N[(re + 1.0), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.9e+154], t$95$1, N[(N[Sin[im], $MachinePrecision] * t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(re \cdot 0.5\right)\\
t_1 := e^{re} \cdot im\\
\mathbf{if}\;re \leq -0.00255:\\
\;\;\;\;t_1\\
\mathbf{elif}\;re \leq 0.028:\\
\;\;\;\;\sin im \cdot \left(\left(re + 1\right) + t_0\right)\\
\mathbf{elif}\;re \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin im \cdot t_0\\
\end{array}
\end{array}
if re < -0.0025500000000000002 or 0.0280000000000000006 < re < 1.8999999999999999e154Initial program 100.0%
Taylor expanded in im around 0 94.6%
if -0.0025500000000000002 < re < 0.0280000000000000006Initial program 100.0%
Taylor expanded in re around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
*-commutative100.0%
distribute-lft1-in100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
if 1.8999999999999999e154 < re Initial program 100.0%
Taylor expanded in re around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
*-commutative100.0%
distribute-lft1-in100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in re around inf 100.0%
unpow2100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
Final simplification98.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) im)))
(if (<= re -2.15e-7)
t_0
(if (<= re 0.006)
(* (sin im) (+ re 1.0))
(if (<= re 1.9e+154) t_0 (* (sin im) (* re (* re 0.5))))))))
double code(double re, double im) {
double t_0 = exp(re) * im;
double tmp;
if (re <= -2.15e-7) {
tmp = t_0;
} else if (re <= 0.006) {
tmp = sin(im) * (re + 1.0);
} else if (re <= 1.9e+154) {
tmp = t_0;
} else {
tmp = sin(im) * (re * (re * 0.5));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = exp(re) * im
if (re <= (-2.15d-7)) then
tmp = t_0
else if (re <= 0.006d0) then
tmp = sin(im) * (re + 1.0d0)
else if (re <= 1.9d+154) then
tmp = t_0
else
tmp = sin(im) * (re * (re * 0.5d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.exp(re) * im;
double tmp;
if (re <= -2.15e-7) {
tmp = t_0;
} else if (re <= 0.006) {
tmp = Math.sin(im) * (re + 1.0);
} else if (re <= 1.9e+154) {
tmp = t_0;
} else {
tmp = Math.sin(im) * (re * (re * 0.5));
}
return tmp;
}
def code(re, im): t_0 = math.exp(re) * im tmp = 0 if re <= -2.15e-7: tmp = t_0 elif re <= 0.006: tmp = math.sin(im) * (re + 1.0) elif re <= 1.9e+154: tmp = t_0 else: tmp = math.sin(im) * (re * (re * 0.5)) return tmp
function code(re, im) t_0 = Float64(exp(re) * im) tmp = 0.0 if (re <= -2.15e-7) tmp = t_0; elseif (re <= 0.006) tmp = Float64(sin(im) * Float64(re + 1.0)); elseif (re <= 1.9e+154) tmp = t_0; else tmp = Float64(sin(im) * Float64(re * Float64(re * 0.5))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(re) * im; tmp = 0.0; if (re <= -2.15e-7) tmp = t_0; elseif (re <= 0.006) tmp = sin(im) * (re + 1.0); elseif (re <= 1.9e+154) tmp = t_0; else tmp = sin(im) * (re * (re * 0.5)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision]}, If[LessEqual[re, -2.15e-7], t$95$0, If[LessEqual[re, 0.006], N[(N[Sin[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.9e+154], t$95$0, N[(N[Sin[im], $MachinePrecision] * N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot im\\
\mathbf{if}\;re \leq -2.15 \cdot 10^{-7}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;re \leq 0.006:\\
\;\;\;\;\sin im \cdot \left(re + 1\right)\\
\mathbf{elif}\;re \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\sin im \cdot \left(re \cdot \left(re \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if re < -2.1500000000000001e-7 or 0.0060000000000000001 < re < 1.8999999999999999e154Initial program 100.0%
Taylor expanded in im around 0 94.7%
if -2.1500000000000001e-7 < re < 0.0060000000000000001Initial program 100.0%
Taylor expanded in re around 0 100.0%
*-commutative100.0%
distribute-rgt1-in100.0%
Simplified100.0%
if 1.8999999999999999e154 < re Initial program 100.0%
Taylor expanded in re around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
*-commutative100.0%
distribute-lft1-in100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in re around inf 100.0%
unpow2100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
Final simplification98.0%
(FPCore (re im) :precision binary64 (if (or (<= re -2.15e-7) (not (<= re 0.0005))) (* (exp re) im) (* (sin im) (+ re 1.0))))
double code(double re, double im) {
double tmp;
if ((re <= -2.15e-7) || !(re <= 0.0005)) {
tmp = exp(re) * im;
} else {
tmp = sin(im) * (re + 1.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((re <= (-2.15d-7)) .or. (.not. (re <= 0.0005d0))) then
tmp = exp(re) * im
else
tmp = sin(im) * (re + 1.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((re <= -2.15e-7) || !(re <= 0.0005)) {
tmp = Math.exp(re) * im;
} else {
tmp = Math.sin(im) * (re + 1.0);
}
return tmp;
}
def code(re, im): tmp = 0 if (re <= -2.15e-7) or not (re <= 0.0005): tmp = math.exp(re) * im else: tmp = math.sin(im) * (re + 1.0) return tmp
function code(re, im) tmp = 0.0 if ((re <= -2.15e-7) || !(re <= 0.0005)) tmp = Float64(exp(re) * im); else tmp = Float64(sin(im) * Float64(re + 1.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((re <= -2.15e-7) || ~((re <= 0.0005))) tmp = exp(re) * im; else tmp = sin(im) * (re + 1.0); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[re, -2.15e-7], N[Not[LessEqual[re, 0.0005]], $MachinePrecision]], N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision], N[(N[Sin[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -2.15 \cdot 10^{-7} \lor \neg \left(re \leq 0.0005\right):\\
\;\;\;\;e^{re} \cdot im\\
\mathbf{else}:\\
\;\;\;\;\sin im \cdot \left(re + 1\right)\\
\end{array}
\end{array}
if re < -2.1500000000000001e-7 or 5.0000000000000001e-4 < re Initial program 100.0%
Taylor expanded in im around 0 91.3%
if -2.1500000000000001e-7 < re < 5.0000000000000001e-4Initial program 100.0%
Taylor expanded in re around 0 100.0%
*-commutative100.0%
distribute-rgt1-in100.0%
Simplified100.0%
Final simplification95.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- 1.0 (* re re))))
(if (<= re -2.15e-7)
(* t_0 (* (+ re 1.0) (/ im t_0)))
(if (<= re 4.8e+64) (sin im) (* (* re re) (* im 0.5))))))
double code(double re, double im) {
double t_0 = 1.0 - (re * re);
double tmp;
if (re <= -2.15e-7) {
tmp = t_0 * ((re + 1.0) * (im / t_0));
} else if (re <= 4.8e+64) {
tmp = sin(im);
} else {
tmp = (re * re) * (im * 0.5);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (re * re)
if (re <= (-2.15d-7)) then
tmp = t_0 * ((re + 1.0d0) * (im / t_0))
else if (re <= 4.8d+64) then
tmp = sin(im)
else
tmp = (re * re) * (im * 0.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 1.0 - (re * re);
double tmp;
if (re <= -2.15e-7) {
tmp = t_0 * ((re + 1.0) * (im / t_0));
} else if (re <= 4.8e+64) {
tmp = Math.sin(im);
} else {
tmp = (re * re) * (im * 0.5);
}
return tmp;
}
def code(re, im): t_0 = 1.0 - (re * re) tmp = 0 if re <= -2.15e-7: tmp = t_0 * ((re + 1.0) * (im / t_0)) elif re <= 4.8e+64: tmp = math.sin(im) else: tmp = (re * re) * (im * 0.5) return tmp
function code(re, im) t_0 = Float64(1.0 - Float64(re * re)) tmp = 0.0 if (re <= -2.15e-7) tmp = Float64(t_0 * Float64(Float64(re + 1.0) * Float64(im / t_0))); elseif (re <= 4.8e+64) tmp = sin(im); else tmp = Float64(Float64(re * re) * Float64(im * 0.5)); end return tmp end
function tmp_2 = code(re, im) t_0 = 1.0 - (re * re); tmp = 0.0; if (re <= -2.15e-7) tmp = t_0 * ((re + 1.0) * (im / t_0)); elseif (re <= 4.8e+64) tmp = sin(im); else tmp = (re * re) * (im * 0.5); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(1.0 - N[(re * re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -2.15e-7], N[(t$95$0 * N[(N[(re + 1.0), $MachinePrecision] * N[(im / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 4.8e+64], N[Sin[im], $MachinePrecision], N[(N[(re * re), $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - re \cdot re\\
\mathbf{if}\;re \leq -2.15 \cdot 10^{-7}:\\
\;\;\;\;t_0 \cdot \left(\left(re + 1\right) \cdot \frac{im}{t_0}\right)\\
\mathbf{elif}\;re \leq 4.8 \cdot 10^{+64}:\\
\;\;\;\;\sin im\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(im \cdot 0.5\right)\\
\end{array}
\end{array}
if re < -2.1500000000000001e-7Initial program 100.0%
Taylor expanded in re around 0 6.0%
*-commutative6.0%
distribute-rgt1-in6.0%
Simplified6.0%
Taylor expanded in im around 0 5.8%
*-commutative5.8%
flip-+5.6%
associate-*r/5.6%
metadata-eval5.6%
Applied egg-rr5.6%
associate-/l*5.6%
associate-/r/11.3%
Simplified11.3%
flip--10.8%
metadata-eval10.8%
associate-/r/19.7%
Applied egg-rr19.7%
if -2.1500000000000001e-7 < re < 4.79999999999999999e64Initial program 100.0%
Taylor expanded in re around 0 93.4%
if 4.79999999999999999e64 < re Initial program 100.0%
Taylor expanded in re around 0 64.0%
associate-+r+64.0%
+-commutative64.0%
*-commutative64.0%
distribute-lft1-in64.0%
*-commutative64.0%
associate-*r*64.0%
distribute-rgt-out64.0%
*-commutative64.0%
unpow264.0%
associate-*l*64.0%
Simplified64.0%
Taylor expanded in re around inf 64.0%
unpow264.0%
*-commutative64.0%
associate-*r*64.0%
Simplified64.0%
Taylor expanded in im around 0 71.9%
*-commutative71.9%
associate-*l*71.9%
unpow271.9%
Simplified71.9%
Final simplification70.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- 1.0 (* re re))))
(if (<= re -2.3e-131)
(* t_0 (* (+ re 1.0) (/ im t_0)))
(if (<= re 2.2e+65)
(+ im (* -0.16666666666666666 (* im (* im im))))
(* (* re re) (* im 0.5))))))
double code(double re, double im) {
double t_0 = 1.0 - (re * re);
double tmp;
if (re <= -2.3e-131) {
tmp = t_0 * ((re + 1.0) * (im / t_0));
} else if (re <= 2.2e+65) {
tmp = im + (-0.16666666666666666 * (im * (im * im)));
} else {
tmp = (re * re) * (im * 0.5);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (re * re)
if (re <= (-2.3d-131)) then
tmp = t_0 * ((re + 1.0d0) * (im / t_0))
else if (re <= 2.2d+65) then
tmp = im + ((-0.16666666666666666d0) * (im * (im * im)))
else
tmp = (re * re) * (im * 0.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 1.0 - (re * re);
double tmp;
if (re <= -2.3e-131) {
tmp = t_0 * ((re + 1.0) * (im / t_0));
} else if (re <= 2.2e+65) {
tmp = im + (-0.16666666666666666 * (im * (im * im)));
} else {
tmp = (re * re) * (im * 0.5);
}
return tmp;
}
def code(re, im): t_0 = 1.0 - (re * re) tmp = 0 if re <= -2.3e-131: tmp = t_0 * ((re + 1.0) * (im / t_0)) elif re <= 2.2e+65: tmp = im + (-0.16666666666666666 * (im * (im * im))) else: tmp = (re * re) * (im * 0.5) return tmp
function code(re, im) t_0 = Float64(1.0 - Float64(re * re)) tmp = 0.0 if (re <= -2.3e-131) tmp = Float64(t_0 * Float64(Float64(re + 1.0) * Float64(im / t_0))); elseif (re <= 2.2e+65) tmp = Float64(im + Float64(-0.16666666666666666 * Float64(im * Float64(im * im)))); else tmp = Float64(Float64(re * re) * Float64(im * 0.5)); end return tmp end
function tmp_2 = code(re, im) t_0 = 1.0 - (re * re); tmp = 0.0; if (re <= -2.3e-131) tmp = t_0 * ((re + 1.0) * (im / t_0)); elseif (re <= 2.2e+65) tmp = im + (-0.16666666666666666 * (im * (im * im))); else tmp = (re * re) * (im * 0.5); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(1.0 - N[(re * re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -2.3e-131], N[(t$95$0 * N[(N[(re + 1.0), $MachinePrecision] * N[(im / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.2e+65], N[(im + N[(-0.16666666666666666 * N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re * re), $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - re \cdot re\\
\mathbf{if}\;re \leq -2.3 \cdot 10^{-131}:\\
\;\;\;\;t_0 \cdot \left(\left(re + 1\right) \cdot \frac{im}{t_0}\right)\\
\mathbf{elif}\;re \leq 2.2 \cdot 10^{+65}:\\
\;\;\;\;im + -0.16666666666666666 \cdot \left(im \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(im \cdot 0.5\right)\\
\end{array}
\end{array}
if re < -2.30000000000000022e-131Initial program 100.0%
Taylor expanded in re around 0 36.4%
*-commutative36.4%
distribute-rgt1-in36.4%
Simplified36.4%
Taylor expanded in im around 0 20.1%
*-commutative20.1%
flip-+20.0%
associate-*r/20.0%
metadata-eval20.0%
Applied egg-rr20.0%
associate-/l*20.0%
associate-/r/23.8%
Simplified23.8%
flip--23.5%
metadata-eval23.5%
associate-/r/29.5%
Applied egg-rr29.5%
if -2.30000000000000022e-131 < re < 2.1999999999999998e65Initial program 100.0%
Taylor expanded in re around 0 91.9%
*-commutative91.9%
distribute-rgt1-in91.9%
Simplified91.9%
Taylor expanded in im around 0 51.6%
Taylor expanded in re around 0 52.6%
unpow352.6%
Applied egg-rr52.6%
if 2.1999999999999998e65 < re Initial program 100.0%
Taylor expanded in re around 0 64.0%
associate-+r+64.0%
+-commutative64.0%
*-commutative64.0%
distribute-lft1-in64.0%
*-commutative64.0%
associate-*r*64.0%
distribute-rgt-out64.0%
*-commutative64.0%
unpow264.0%
associate-*l*64.0%
Simplified64.0%
Taylor expanded in re around inf 64.0%
unpow264.0%
*-commutative64.0%
associate-*r*64.0%
Simplified64.0%
Taylor expanded in im around 0 71.9%
*-commutative71.9%
associate-*l*71.9%
unpow271.9%
Simplified71.9%
Final simplification47.9%
(FPCore (re im)
:precision binary64
(if (<= re -1.35e-129)
(* (- 1.0 (* re re)) (/ im (- 1.0 re)))
(if (<= re 6.1e+63)
(+ im (* -0.16666666666666666 (* im (* im im))))
(* (* re re) (* im 0.5)))))
double code(double re, double im) {
double tmp;
if (re <= -1.35e-129) {
tmp = (1.0 - (re * re)) * (im / (1.0 - re));
} else if (re <= 6.1e+63) {
tmp = im + (-0.16666666666666666 * (im * (im * im)));
} else {
tmp = (re * re) * (im * 0.5);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-1.35d-129)) then
tmp = (1.0d0 - (re * re)) * (im / (1.0d0 - re))
else if (re <= 6.1d+63) then
tmp = im + ((-0.16666666666666666d0) * (im * (im * im)))
else
tmp = (re * re) * (im * 0.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -1.35e-129) {
tmp = (1.0 - (re * re)) * (im / (1.0 - re));
} else if (re <= 6.1e+63) {
tmp = im + (-0.16666666666666666 * (im * (im * im)));
} else {
tmp = (re * re) * (im * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -1.35e-129: tmp = (1.0 - (re * re)) * (im / (1.0 - re)) elif re <= 6.1e+63: tmp = im + (-0.16666666666666666 * (im * (im * im))) else: tmp = (re * re) * (im * 0.5) return tmp
function code(re, im) tmp = 0.0 if (re <= -1.35e-129) tmp = Float64(Float64(1.0 - Float64(re * re)) * Float64(im / Float64(1.0 - re))); elseif (re <= 6.1e+63) tmp = Float64(im + Float64(-0.16666666666666666 * Float64(im * Float64(im * im)))); else tmp = Float64(Float64(re * re) * Float64(im * 0.5)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -1.35e-129) tmp = (1.0 - (re * re)) * (im / (1.0 - re)); elseif (re <= 6.1e+63) tmp = im + (-0.16666666666666666 * (im * (im * im))); else tmp = (re * re) * (im * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -1.35e-129], N[(N[(1.0 - N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(im / N[(1.0 - re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 6.1e+63], N[(im + N[(-0.16666666666666666 * N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re * re), $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -1.35 \cdot 10^{-129}:\\
\;\;\;\;\left(1 - re \cdot re\right) \cdot \frac{im}{1 - re}\\
\mathbf{elif}\;re \leq 6.1 \cdot 10^{+63}:\\
\;\;\;\;im + -0.16666666666666666 \cdot \left(im \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(im \cdot 0.5\right)\\
\end{array}
\end{array}
if re < -1.35e-129Initial program 100.0%
Taylor expanded in re around 0 36.4%
*-commutative36.4%
distribute-rgt1-in36.4%
Simplified36.4%
Taylor expanded in im around 0 20.1%
*-commutative20.1%
flip-+20.0%
associate-*r/20.0%
metadata-eval20.0%
Applied egg-rr20.0%
associate-/l*20.0%
associate-/r/23.8%
Simplified23.8%
if -1.35e-129 < re < 6.09999999999999968e63Initial program 100.0%
Taylor expanded in re around 0 91.9%
*-commutative91.9%
distribute-rgt1-in91.9%
Simplified91.9%
Taylor expanded in im around 0 51.6%
Taylor expanded in re around 0 52.6%
unpow352.6%
Applied egg-rr52.6%
if 6.09999999999999968e63 < re Initial program 100.0%
Taylor expanded in re around 0 64.0%
associate-+r+64.0%
+-commutative64.0%
*-commutative64.0%
distribute-lft1-in64.0%
*-commutative64.0%
associate-*r*64.0%
distribute-rgt-out64.0%
*-commutative64.0%
unpow264.0%
associate-*l*64.0%
Simplified64.0%
Taylor expanded in re around inf 64.0%
unpow264.0%
*-commutative64.0%
associate-*r*64.0%
Simplified64.0%
Taylor expanded in im around 0 71.9%
*-commutative71.9%
associate-*l*71.9%
unpow271.9%
Simplified71.9%
Final simplification45.7%
(FPCore (re im)
:precision binary64
(if (<= re -2.5e-130)
(/ (- 1.0 (* re re)) (/ (- 1.0 re) im))
(if (<= re 7.5e+64)
(+ im (* -0.16666666666666666 (* im (* im im))))
(* (* re re) (* im 0.5)))))
double code(double re, double im) {
double tmp;
if (re <= -2.5e-130) {
tmp = (1.0 - (re * re)) / ((1.0 - re) / im);
} else if (re <= 7.5e+64) {
tmp = im + (-0.16666666666666666 * (im * (im * im)));
} else {
tmp = (re * re) * (im * 0.5);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-2.5d-130)) then
tmp = (1.0d0 - (re * re)) / ((1.0d0 - re) / im)
else if (re <= 7.5d+64) then
tmp = im + ((-0.16666666666666666d0) * (im * (im * im)))
else
tmp = (re * re) * (im * 0.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -2.5e-130) {
tmp = (1.0 - (re * re)) / ((1.0 - re) / im);
} else if (re <= 7.5e+64) {
tmp = im + (-0.16666666666666666 * (im * (im * im)));
} else {
tmp = (re * re) * (im * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -2.5e-130: tmp = (1.0 - (re * re)) / ((1.0 - re) / im) elif re <= 7.5e+64: tmp = im + (-0.16666666666666666 * (im * (im * im))) else: tmp = (re * re) * (im * 0.5) return tmp
function code(re, im) tmp = 0.0 if (re <= -2.5e-130) tmp = Float64(Float64(1.0 - Float64(re * re)) / Float64(Float64(1.0 - re) / im)); elseif (re <= 7.5e+64) tmp = Float64(im + Float64(-0.16666666666666666 * Float64(im * Float64(im * im)))); else tmp = Float64(Float64(re * re) * Float64(im * 0.5)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -2.5e-130) tmp = (1.0 - (re * re)) / ((1.0 - re) / im); elseif (re <= 7.5e+64) tmp = im + (-0.16666666666666666 * (im * (im * im))); else tmp = (re * re) * (im * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -2.5e-130], N[(N[(1.0 - N[(re * re), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 - re), $MachinePrecision] / im), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 7.5e+64], N[(im + N[(-0.16666666666666666 * N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re * re), $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -2.5 \cdot 10^{-130}:\\
\;\;\;\;\frac{1 - re \cdot re}{\frac{1 - re}{im}}\\
\mathbf{elif}\;re \leq 7.5 \cdot 10^{+64}:\\
\;\;\;\;im + -0.16666666666666666 \cdot \left(im \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(im \cdot 0.5\right)\\
\end{array}
\end{array}
if re < -2.4999999999999998e-130Initial program 100.0%
Taylor expanded in re around 0 36.4%
*-commutative36.4%
distribute-rgt1-in36.4%
Simplified36.4%
add-sqr-sqrt13.8%
pow213.8%
Applied egg-rr13.8%
unpow213.8%
add-sqr-sqrt36.4%
+-commutative36.4%
*-commutative36.4%
flip-+36.2%
associate-*r/36.2%
metadata-eval36.2%
Applied egg-rr36.2%
*-commutative36.2%
associate-/l*40.8%
Simplified40.8%
Taylor expanded in im around 0 24.7%
if -2.4999999999999998e-130 < re < 7.5000000000000005e64Initial program 100.0%
Taylor expanded in re around 0 91.9%
*-commutative91.9%
distribute-rgt1-in91.9%
Simplified91.9%
Taylor expanded in im around 0 51.6%
Taylor expanded in re around 0 52.6%
unpow352.6%
Applied egg-rr52.6%
if 7.5000000000000005e64 < re Initial program 100.0%
Taylor expanded in re around 0 64.0%
associate-+r+64.0%
+-commutative64.0%
*-commutative64.0%
distribute-lft1-in64.0%
*-commutative64.0%
associate-*r*64.0%
distribute-rgt-out64.0%
*-commutative64.0%
unpow264.0%
associate-*l*64.0%
Simplified64.0%
Taylor expanded in re around inf 64.0%
unpow264.0%
*-commutative64.0%
associate-*r*64.0%
Simplified64.0%
Taylor expanded in im around 0 71.9%
*-commutative71.9%
associate-*l*71.9%
unpow271.9%
Simplified71.9%
Final simplification46.1%
(FPCore (re im) :precision binary64 (if (<= re 2.35e+65) (+ im (* -0.16666666666666666 (* im (* im im)))) (* (* re re) (* im 0.5))))
double code(double re, double im) {
double tmp;
if (re <= 2.35e+65) {
tmp = im + (-0.16666666666666666 * (im * (im * im)));
} else {
tmp = (re * re) * (im * 0.5);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 2.35d+65) then
tmp = im + ((-0.16666666666666666d0) * (im * (im * im)))
else
tmp = (re * re) * (im * 0.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 2.35e+65) {
tmp = im + (-0.16666666666666666 * (im * (im * im)));
} else {
tmp = (re * re) * (im * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 2.35e+65: tmp = im + (-0.16666666666666666 * (im * (im * im))) else: tmp = (re * re) * (im * 0.5) return tmp
function code(re, im) tmp = 0.0 if (re <= 2.35e+65) tmp = Float64(im + Float64(-0.16666666666666666 * Float64(im * Float64(im * im)))); else tmp = Float64(Float64(re * re) * Float64(im * 0.5)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 2.35e+65) tmp = im + (-0.16666666666666666 * (im * (im * im))); else tmp = (re * re) * (im * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 2.35e+65], N[(im + N[(-0.16666666666666666 * N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re * re), $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.35 \cdot 10^{+65}:\\
\;\;\;\;im + -0.16666666666666666 \cdot \left(im \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(im \cdot 0.5\right)\\
\end{array}
\end{array}
if re < 2.3500000000000001e65Initial program 100.0%
Taylor expanded in re around 0 65.8%
*-commutative65.8%
distribute-rgt1-in65.8%
Simplified65.8%
Taylor expanded in im around 0 36.6%
Taylor expanded in re around 0 37.0%
unpow337.0%
Applied egg-rr37.0%
if 2.3500000000000001e65 < re Initial program 100.0%
Taylor expanded in re around 0 64.0%
associate-+r+64.0%
+-commutative64.0%
*-commutative64.0%
distribute-lft1-in64.0%
*-commutative64.0%
associate-*r*64.0%
distribute-rgt-out64.0%
*-commutative64.0%
unpow264.0%
associate-*l*64.0%
Simplified64.0%
Taylor expanded in re around inf 64.0%
unpow264.0%
*-commutative64.0%
associate-*r*64.0%
Simplified64.0%
Taylor expanded in im around 0 71.9%
*-commutative71.9%
associate-*l*71.9%
unpow271.9%
Simplified71.9%
Final simplification44.1%
(FPCore (re im) :precision binary64 (if (<= re 1.05e-15) (* im (+ re 1.0)) (* (* re re) (* im 0.5))))
double code(double re, double im) {
double tmp;
if (re <= 1.05e-15) {
tmp = im * (re + 1.0);
} else {
tmp = (re * re) * (im * 0.5);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 1.05d-15) then
tmp = im * (re + 1.0d0)
else
tmp = (re * re) * (im * 0.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.05e-15) {
tmp = im * (re + 1.0);
} else {
tmp = (re * re) * (im * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.05e-15: tmp = im * (re + 1.0) else: tmp = (re * re) * (im * 0.5) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.05e-15) tmp = Float64(im * Float64(re + 1.0)); else tmp = Float64(Float64(re * re) * Float64(im * 0.5)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.05e-15) tmp = im * (re + 1.0); else tmp = (re * re) * (im * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.05e-15], N[(im * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(re * re), $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.05 \cdot 10^{-15}:\\
\;\;\;\;im \cdot \left(re + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(im \cdot 0.5\right)\\
\end{array}
\end{array}
if re < 1.0499999999999999e-15Initial program 100.0%
Taylor expanded in re around 0 68.5%
*-commutative68.5%
distribute-rgt1-in68.5%
Simplified68.5%
Taylor expanded in im around 0 36.7%
if 1.0499999999999999e-15 < re Initial program 100.0%
Taylor expanded in re around 0 55.8%
associate-+r+55.8%
+-commutative55.8%
*-commutative55.8%
distribute-lft1-in55.8%
*-commutative55.8%
associate-*r*55.8%
distribute-rgt-out55.8%
*-commutative55.8%
unpow255.8%
associate-*l*55.8%
Simplified55.8%
Taylor expanded in re around inf 54.3%
unpow254.3%
*-commutative54.3%
associate-*r*54.3%
Simplified54.3%
Taylor expanded in im around 0 60.7%
*-commutative60.7%
associate-*l*60.7%
unpow260.7%
Simplified60.7%
Final simplification42.5%
(FPCore (re im) :precision binary64 (if (<= re 1.05e-15) im (* re im)))
double code(double re, double im) {
double tmp;
if (re <= 1.05e-15) {
tmp = im;
} else {
tmp = re * im;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 1.05d-15) then
tmp = im
else
tmp = re * im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.05e-15) {
tmp = im;
} else {
tmp = re * im;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.05e-15: tmp = im else: tmp = re * im return tmp
function code(re, im) tmp = 0.0 if (re <= 1.05e-15) tmp = im; else tmp = Float64(re * im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.05e-15) tmp = im; else tmp = re * im; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.05e-15], im, N[(re * im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.05 \cdot 10^{-15}:\\
\;\;\;\;im\\
\mathbf{else}:\\
\;\;\;\;re \cdot im\\
\end{array}
\end{array}
if re < 1.0499999999999999e-15Initial program 100.0%
Taylor expanded in im around 0 68.3%
Taylor expanded in re around 0 36.6%
if 1.0499999999999999e-15 < re Initial program 100.0%
Taylor expanded in re around 0 5.9%
*-commutative5.9%
distribute-rgt1-in5.9%
Simplified5.9%
Taylor expanded in im around 0 29.6%
Taylor expanded in re around inf 29.7%
Final simplification34.9%
(FPCore (re im) :precision binary64 (* im (+ re 1.0)))
double code(double re, double im) {
return im * (re + 1.0);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = im * (re + 1.0d0)
end function
public static double code(double re, double im) {
return im * (re + 1.0);
}
def code(re, im): return im * (re + 1.0)
function code(re, im) return Float64(im * Float64(re + 1.0)) end
function tmp = code(re, im) tmp = im * (re + 1.0); end
code[re_, im_] := N[(im * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
im \cdot \left(re + 1\right)
\end{array}
Initial program 100.0%
Taylor expanded in re around 0 53.4%
*-commutative53.4%
distribute-rgt1-in53.4%
Simplified53.4%
Taylor expanded in im around 0 35.0%
Final simplification35.0%
(FPCore (re im) :precision binary64 im)
double code(double re, double im) {
return im;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = im
end function
public static double code(double re, double im) {
return im;
}
def code(re, im): return im
function code(re, im) return im end
function tmp = code(re, im) tmp = im; end
code[re_, im_] := im
\begin{array}{l}
\\
im
\end{array}
Initial program 100.0%
Taylor expanded in im around 0 71.3%
Taylor expanded in re around 0 28.6%
Final simplification28.6%
herbie shell --seed 2023200
(FPCore (re im)
:name "math.exp on complex, imaginary part"
:precision binary64
(* (exp re) (sin im)))