
(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 12 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 (<= re -0.22) (and (not (<= re 600000.0)) (<= re 1e+103)))
(* (exp re) im)
(*
(sin im)
(+ (+ re 1.0) (* (* re re) (+ (* re 0.16666666666666666) 0.5))))))
double code(double re, double im) {
double tmp;
if ((re <= -0.22) || (!(re <= 600000.0) && (re <= 1e+103))) {
tmp = exp(re) * im;
} else {
tmp = sin(im) * ((re + 1.0) + ((re * re) * ((re * 0.16666666666666666) + 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 <= (-0.22d0)) .or. (.not. (re <= 600000.0d0)) .and. (re <= 1d+103)) then
tmp = exp(re) * im
else
tmp = sin(im) * ((re + 1.0d0) + ((re * re) * ((re * 0.16666666666666666d0) + 0.5d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((re <= -0.22) || (!(re <= 600000.0) && (re <= 1e+103))) {
tmp = Math.exp(re) * im;
} else {
tmp = Math.sin(im) * ((re + 1.0) + ((re * re) * ((re * 0.16666666666666666) + 0.5)));
}
return tmp;
}
def code(re, im): tmp = 0 if (re <= -0.22) or (not (re <= 600000.0) and (re <= 1e+103)): tmp = math.exp(re) * im else: tmp = math.sin(im) * ((re + 1.0) + ((re * re) * ((re * 0.16666666666666666) + 0.5))) return tmp
function code(re, im) tmp = 0.0 if ((re <= -0.22) || (!(re <= 600000.0) && (re <= 1e+103))) tmp = Float64(exp(re) * im); else tmp = Float64(sin(im) * Float64(Float64(re + 1.0) + Float64(Float64(re * re) * Float64(Float64(re * 0.16666666666666666) + 0.5)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((re <= -0.22) || (~((re <= 600000.0)) && (re <= 1e+103))) tmp = exp(re) * im; else tmp = sin(im) * ((re + 1.0) + ((re * re) * ((re * 0.16666666666666666) + 0.5))); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[re, -0.22], And[N[Not[LessEqual[re, 600000.0]], $MachinePrecision], LessEqual[re, 1e+103]]], N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision], N[(N[Sin[im], $MachinePrecision] * N[(N[(re + 1.0), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * N[(N[(re * 0.16666666666666666), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.22 \lor \neg \left(re \leq 600000\right) \land re \leq 10^{+103}:\\
\;\;\;\;e^{re} \cdot im\\
\mathbf{else}:\\
\;\;\;\;\sin im \cdot \left(\left(re + 1\right) + \left(re \cdot re\right) \cdot \left(re \cdot 0.16666666666666666 + 0.5\right)\right)\\
\end{array}
\end{array}
if re < -0.220000000000000001 or 6e5 < re < 1e103Initial program 100.0%
Taylor expanded in im around 0 93.0%
if -0.220000000000000001 < re < 6e5 or 1e103 < re Initial program 100.0%
Taylor expanded in re around 0 99.4%
associate-+r+99.4%
*-commutative99.4%
distribute-rgt1-in99.4%
*-commutative99.4%
+-commutative99.4%
*-commutative99.4%
associate-*r*99.4%
*-commutative99.4%
associate-*r*99.4%
distribute-rgt-out99.4%
distribute-lft-out99.4%
+-commutative99.4%
Simplified99.4%
Final simplification97.3%
(FPCore (re im) :precision binary64 (if (or (<= re -0.02) (not (<= re 600000.0))) (* (exp re) im) (* (sin im) (+ (+ re 1.0) (* re (* re 0.5))))))
double code(double re, double im) {
double tmp;
if ((re <= -0.02) || !(re <= 600000.0)) {
tmp = exp(re) * im;
} else {
tmp = sin(im) * ((re + 1.0) + (re * (re * 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 <= (-0.02d0)) .or. (.not. (re <= 600000.0d0))) then
tmp = exp(re) * im
else
tmp = sin(im) * ((re + 1.0d0) + (re * (re * 0.5d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((re <= -0.02) || !(re <= 600000.0)) {
tmp = Math.exp(re) * im;
} else {
tmp = Math.sin(im) * ((re + 1.0) + (re * (re * 0.5)));
}
return tmp;
}
def code(re, im): tmp = 0 if (re <= -0.02) or not (re <= 600000.0): tmp = math.exp(re) * im else: tmp = math.sin(im) * ((re + 1.0) + (re * (re * 0.5))) return tmp
function code(re, im) tmp = 0.0 if ((re <= -0.02) || !(re <= 600000.0)) tmp = Float64(exp(re) * im); else tmp = Float64(sin(im) * Float64(Float64(re + 1.0) + Float64(re * Float64(re * 0.5)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((re <= -0.02) || ~((re <= 600000.0))) tmp = exp(re) * im; else tmp = sin(im) * ((re + 1.0) + (re * (re * 0.5))); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[re, -0.02], N[Not[LessEqual[re, 600000.0]], $MachinePrecision]], N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision], N[(N[Sin[im], $MachinePrecision] * N[(N[(re + 1.0), $MachinePrecision] + N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.02 \lor \neg \left(re \leq 600000\right):\\
\;\;\;\;e^{re} \cdot im\\
\mathbf{else}:\\
\;\;\;\;\sin im \cdot \left(\left(re + 1\right) + re \cdot \left(re \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if re < -0.0200000000000000004 or 6e5 < re Initial program 100.0%
Taylor expanded in im around 0 89.4%
if -0.0200000000000000004 < re < 6e5Initial program 100.0%
Taylor expanded in re around 0 99.2%
associate-+r+99.2%
+-commutative99.2%
*-commutative99.2%
distribute-lft1-in99.2%
*-commutative99.2%
associate-*r*99.2%
distribute-rgt-out99.2%
*-commutative99.2%
unpow299.2%
associate-*l*99.2%
Simplified99.2%
Final simplification94.5%
(FPCore (re im) :precision binary64 (if (or (<= re -0.00027) (not (<= re 600000.0))) (* (exp re) im) (* (sin im) (+ re 1.0))))
double code(double re, double im) {
double tmp;
if ((re <= -0.00027) || !(re <= 600000.0)) {
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 <= (-0.00027d0)) .or. (.not. (re <= 600000.0d0))) 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 <= -0.00027) || !(re <= 600000.0)) {
tmp = Math.exp(re) * im;
} else {
tmp = Math.sin(im) * (re + 1.0);
}
return tmp;
}
def code(re, im): tmp = 0 if (re <= -0.00027) or not (re <= 600000.0): tmp = math.exp(re) * im else: tmp = math.sin(im) * (re + 1.0) return tmp
function code(re, im) tmp = 0.0 if ((re <= -0.00027) || !(re <= 600000.0)) 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 <= -0.00027) || ~((re <= 600000.0))) tmp = exp(re) * im; else tmp = sin(im) * (re + 1.0); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[re, -0.00027], N[Not[LessEqual[re, 600000.0]], $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 -0.00027 \lor \neg \left(re \leq 600000\right):\\
\;\;\;\;e^{re} \cdot im\\
\mathbf{else}:\\
\;\;\;\;\sin im \cdot \left(re + 1\right)\\
\end{array}
\end{array}
if re < -2.70000000000000003e-4 or 6e5 < re Initial program 100.0%
Taylor expanded in im around 0 89.4%
if -2.70000000000000003e-4 < re < 6e5Initial program 100.0%
Taylor expanded in re around 0 98.9%
*-commutative98.9%
distribute-rgt1-in98.9%
Simplified98.9%
Final simplification94.4%
(FPCore (re im) :precision binary64 (if (or (<= re -5e-5) (not (<= re 600000.0))) (* (exp re) im) (sin im)))
double code(double re, double im) {
double tmp;
if ((re <= -5e-5) || !(re <= 600000.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 ((re <= (-5d-5)) .or. (.not. (re <= 600000.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 ((re <= -5e-5) || !(re <= 600000.0)) {
tmp = Math.exp(re) * im;
} else {
tmp = Math.sin(im);
}
return tmp;
}
def code(re, im): tmp = 0 if (re <= -5e-5) or not (re <= 600000.0): tmp = math.exp(re) * im else: tmp = math.sin(im) return tmp
function code(re, im) tmp = 0.0 if ((re <= -5e-5) || !(re <= 600000.0)) tmp = Float64(exp(re) * im); else tmp = sin(im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((re <= -5e-5) || ~((re <= 600000.0))) tmp = exp(re) * im; else tmp = sin(im); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[re, -5e-5], N[Not[LessEqual[re, 600000.0]], $MachinePrecision]], N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision], N[Sin[im], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -5 \cdot 10^{-5} \lor \neg \left(re \leq 600000\right):\\
\;\;\;\;e^{re} \cdot im\\
\mathbf{else}:\\
\;\;\;\;\sin im\\
\end{array}
\end{array}
if re < -5.00000000000000024e-5 or 6e5 < re Initial program 100.0%
Taylor expanded in im around 0 89.4%
if -5.00000000000000024e-5 < re < 6e5Initial program 100.0%
Taylor expanded in re around 0 98.1%
Final simplification93.9%
(FPCore (re im) :precision binary64 (if (<= re 1.5e+61) (expm1 im) (* im (* re (* re 0.5)))))
double code(double re, double im) {
double tmp;
if (re <= 1.5e+61) {
tmp = expm1(im);
} else {
tmp = im * (re * (re * 0.5));
}
return tmp;
}
public static double code(double re, double im) {
double tmp;
if (re <= 1.5e+61) {
tmp = Math.expm1(im);
} else {
tmp = im * (re * (re * 0.5));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.5e+61: tmp = math.expm1(im) else: tmp = im * (re * (re * 0.5)) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.5e+61) tmp = expm1(im); else tmp = Float64(im * Float64(re * Float64(re * 0.5))); end return tmp end
code[re_, im_] := If[LessEqual[re, 1.5e+61], N[(Exp[im] - 1), $MachinePrecision], N[(im * N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.5 \cdot 10^{+61}:\\
\;\;\;\;\mathsf{expm1}\left(im\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(re \cdot \left(re \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if re < 1.5e61Initial program 100.0%
expm1-log1p-u97.6%
Applied egg-rr97.6%
Taylor expanded in re around 0 52.9%
+-commutative52.9%
log1p-def63.1%
Simplified63.1%
Taylor expanded in im around 0 30.2%
if 1.5e61 < re Initial program 100.0%
Taylor expanded in re around 0 48.5%
associate-+r+48.5%
+-commutative48.5%
*-commutative48.5%
distribute-lft1-in48.5%
*-commutative48.5%
associate-*r*48.5%
distribute-rgt-out48.5%
*-commutative48.5%
unpow248.5%
associate-*l*48.5%
Simplified48.5%
Taylor expanded in re around inf 48.5%
unpow248.5%
*-commutative48.5%
associate-*r*48.5%
associate-*r*48.5%
Simplified48.5%
Taylor expanded in im around 0 49.2%
unpow249.2%
associate-*r*49.2%
*-commutative49.2%
associate-*r*49.2%
Simplified49.2%
Final simplification33.5%
(FPCore (re im) :precision binary64 (if (<= re 1.9e+67) (sin im) (* im (* re (* re 0.5)))))
double code(double re, double im) {
double tmp;
if (re <= 1.9e+67) {
tmp = sin(im);
} else {
tmp = 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) :: tmp
if (re <= 1.9d+67) then
tmp = sin(im)
else
tmp = im * (re * (re * 0.5d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.9e+67) {
tmp = Math.sin(im);
} else {
tmp = im * (re * (re * 0.5));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.9e+67: tmp = math.sin(im) else: tmp = im * (re * (re * 0.5)) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.9e+67) tmp = sin(im); else tmp = Float64(im * Float64(re * Float64(re * 0.5))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.9e+67) tmp = sin(im); else tmp = im * (re * (re * 0.5)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.9e+67], N[Sin[im], $MachinePrecision], N[(im * N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.9 \cdot 10^{+67}:\\
\;\;\;\;\sin im\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(re \cdot \left(re \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if re < 1.9000000000000001e67Initial program 100.0%
Taylor expanded in re around 0 62.6%
if 1.9000000000000001e67 < re Initial program 100.0%
Taylor expanded in re around 0 50.6%
associate-+r+50.6%
+-commutative50.6%
*-commutative50.6%
distribute-lft1-in50.6%
*-commutative50.6%
associate-*r*50.6%
distribute-rgt-out50.6%
*-commutative50.6%
unpow250.6%
associate-*l*50.6%
Simplified50.6%
Taylor expanded in re around inf 50.6%
unpow250.6%
*-commutative50.6%
associate-*r*50.6%
associate-*r*50.6%
Simplified50.6%
Taylor expanded in im around 0 51.5%
unpow251.5%
associate-*r*51.5%
*-commutative51.5%
associate-*r*51.5%
Simplified51.5%
Final simplification60.7%
(FPCore (re im) :precision binary64 (if (<= re 1.15e-9) im (* re (* im (* re 0.5)))))
double code(double re, double im) {
double tmp;
if (re <= 1.15e-9) {
tmp = im;
} else {
tmp = re * (im * (re * 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.15d-9) then
tmp = im
else
tmp = re * (im * (re * 0.5d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.15e-9) {
tmp = im;
} else {
tmp = re * (im * (re * 0.5));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.15e-9: tmp = im else: tmp = re * (im * (re * 0.5)) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.15e-9) tmp = im; else tmp = Float64(re * Float64(im * Float64(re * 0.5))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.15e-9) tmp = im; else tmp = re * (im * (re * 0.5)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.15e-9], im, N[(re * N[(im * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.15 \cdot 10^{-9}:\\
\;\;\;\;im\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(im \cdot \left(re \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if re < 1.15e-9Initial program 100.0%
Taylor expanded in re around 0 66.9%
*-commutative66.9%
distribute-rgt1-in66.9%
Simplified66.9%
Taylor expanded in im around 0 30.6%
Taylor expanded in re around 0 31.0%
if 1.15e-9 < re Initial program 99.9%
Taylor expanded in re around 0 40.1%
associate-+r+40.1%
+-commutative40.1%
*-commutative40.1%
distribute-lft1-in40.1%
*-commutative40.1%
associate-*r*40.1%
distribute-rgt-out40.1%
*-commutative40.1%
unpow240.1%
associate-*l*40.1%
Simplified40.1%
Taylor expanded in re around inf 37.2%
unpow237.2%
*-commutative37.2%
associate-*r*37.2%
associate-*r*37.2%
Simplified37.2%
Taylor expanded in im around 0 37.2%
unpow237.2%
associate-*r*37.2%
*-commutative37.2%
associate-*r*37.2%
associate-*l*27.8%
Simplified27.8%
Final simplification30.3%
(FPCore (re im) :precision binary64 (if (<= re 1.15e-9) im (* im (* re (* re 0.5)))))
double code(double re, double im) {
double tmp;
if (re <= 1.15e-9) {
tmp = im;
} else {
tmp = 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) :: tmp
if (re <= 1.15d-9) then
tmp = im
else
tmp = im * (re * (re * 0.5d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.15e-9) {
tmp = im;
} else {
tmp = im * (re * (re * 0.5));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.15e-9: tmp = im else: tmp = im * (re * (re * 0.5)) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.15e-9) tmp = im; else tmp = Float64(im * Float64(re * Float64(re * 0.5))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.15e-9) tmp = im; else tmp = im * (re * (re * 0.5)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.15e-9], im, N[(im * N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.15 \cdot 10^{-9}:\\
\;\;\;\;im\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(re \cdot \left(re \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if re < 1.15e-9Initial program 100.0%
Taylor expanded in re around 0 66.9%
*-commutative66.9%
distribute-rgt1-in66.9%
Simplified66.9%
Taylor expanded in im around 0 30.6%
Taylor expanded in re around 0 31.0%
if 1.15e-9 < re Initial program 99.9%
Taylor expanded in re around 0 40.1%
associate-+r+40.1%
+-commutative40.1%
*-commutative40.1%
distribute-lft1-in40.1%
*-commutative40.1%
associate-*r*40.1%
distribute-rgt-out40.1%
*-commutative40.1%
unpow240.1%
associate-*l*40.1%
Simplified40.1%
Taylor expanded in re around inf 37.2%
unpow237.2%
*-commutative37.2%
associate-*r*37.2%
associate-*r*37.2%
Simplified37.2%
Taylor expanded in im around 0 37.2%
unpow237.2%
associate-*r*37.2%
*-commutative37.2%
associate-*r*37.2%
Simplified37.2%
Final simplification32.4%
(FPCore (re im) :precision binary64 (if (<= re 1.15e-9) im (* re im)))
double code(double re, double im) {
double tmp;
if (re <= 1.15e-9) {
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.15d-9) 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.15e-9) {
tmp = im;
} else {
tmp = re * im;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.15e-9: tmp = im else: tmp = re * im return tmp
function code(re, im) tmp = 0.0 if (re <= 1.15e-9) tmp = im; else tmp = Float64(re * im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.15e-9) tmp = im; else tmp = re * im; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.15e-9], im, N[(re * im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.15 \cdot 10^{-9}:\\
\;\;\;\;im\\
\mathbf{else}:\\
\;\;\;\;re \cdot im\\
\end{array}
\end{array}
if re < 1.15e-9Initial program 100.0%
Taylor expanded in re around 0 66.9%
*-commutative66.9%
distribute-rgt1-in66.9%
Simplified66.9%
Taylor expanded in im around 0 30.6%
Taylor expanded in re around 0 31.0%
if 1.15e-9 < re Initial program 99.9%
Taylor expanded in re around 0 6.5%
*-commutative6.5%
distribute-rgt1-in6.5%
Simplified6.5%
Taylor expanded in im around 0 14.3%
Taylor expanded in re around inf 14.3%
Final simplification27.1%
(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.0%
*-commutative53.0%
distribute-rgt1-in53.0%
Simplified53.0%
Taylor expanded in im around 0 26.8%
Final simplification26.8%
(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 re around 0 53.0%
*-commutative53.0%
distribute-rgt1-in53.0%
Simplified53.0%
Taylor expanded in im around 0 26.8%
Taylor expanded in re around 0 24.4%
Final simplification24.4%
herbie shell --seed 2023240
(FPCore (re im)
:name "math.exp on complex, imaginary part"
:precision binary64
(* (exp re) (sin im)))