
(FPCore (x y z) :precision binary64 (* (+ x y) (- 1.0 z)))
double code(double x, double y, double z) {
return (x + y) * (1.0 - z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + y) * (1.0d0 - z)
end function
public static double code(double x, double y, double z) {
return (x + y) * (1.0 - z);
}
def code(x, y, z): return (x + y) * (1.0 - z)
function code(x, y, z) return Float64(Float64(x + y) * Float64(1.0 - z)) end
function tmp = code(x, y, z) tmp = (x + y) * (1.0 - z); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) \cdot \left(1 - z\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (* (+ x y) (- 1.0 z)))
double code(double x, double y, double z) {
return (x + y) * (1.0 - z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + y) * (1.0d0 - z)
end function
public static double code(double x, double y, double z) {
return (x + y) * (1.0 - z);
}
def code(x, y, z): return (x + y) * (1.0 - z)
function code(x, y, z) return Float64(Float64(x + y) * Float64(1.0 - z)) end
function tmp = code(x, y, z) tmp = (x + y) * (1.0 - z); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) \cdot \left(1 - z\right)
\end{array}
(FPCore (x y z) :precision binary64 (* (- 1.0 z) (+ x y)))
double code(double x, double y, double z) {
return (1.0 - z) * (x + y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 - z) * (x + y)
end function
public static double code(double x, double y, double z) {
return (1.0 - z) * (x + y);
}
def code(x, y, z): return (1.0 - z) * (x + y)
function code(x, y, z) return Float64(Float64(1.0 - z) * Float64(x + y)) end
function tmp = code(x, y, z) tmp = (1.0 - z) * (x + y); end
code[x_, y_, z_] := N[(N[(1.0 - z), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - z\right) \cdot \left(x + y\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (- 1.0 z))) (t_1 (* x (- z))))
(if (<= (- 1.0 z) -1e+209)
(* y (- z))
(if (<= (- 1.0 z) -2e+142)
t_1
(if (<= (- 1.0 z) 1.0)
t_0
(if (<= (- 1.0 z) 1.0002)
(+ x y)
(if (or (<= (- 1.0 z) 5e+86)
(and (not (<= (- 1.0 z) 4e+113))
(or (<= (- 1.0 z) 2e+182)
(not (<= (- 1.0 z) 2e+267)))))
t_0
t_1)))))))
double code(double x, double y, double z) {
double t_0 = y * (1.0 - z);
double t_1 = x * -z;
double tmp;
if ((1.0 - z) <= -1e+209) {
tmp = y * -z;
} else if ((1.0 - z) <= -2e+142) {
tmp = t_1;
} else if ((1.0 - z) <= 1.0) {
tmp = t_0;
} else if ((1.0 - z) <= 1.0002) {
tmp = x + y;
} else if (((1.0 - z) <= 5e+86) || (!((1.0 - z) <= 4e+113) && (((1.0 - z) <= 2e+182) || !((1.0 - z) <= 2e+267)))) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = y * (1.0d0 - z)
t_1 = x * -z
if ((1.0d0 - z) <= (-1d+209)) then
tmp = y * -z
else if ((1.0d0 - z) <= (-2d+142)) then
tmp = t_1
else if ((1.0d0 - z) <= 1.0d0) then
tmp = t_0
else if ((1.0d0 - z) <= 1.0002d0) then
tmp = x + y
else if (((1.0d0 - z) <= 5d+86) .or. (.not. ((1.0d0 - z) <= 4d+113)) .and. ((1.0d0 - z) <= 2d+182) .or. (.not. ((1.0d0 - z) <= 2d+267))) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (1.0 - z);
double t_1 = x * -z;
double tmp;
if ((1.0 - z) <= -1e+209) {
tmp = y * -z;
} else if ((1.0 - z) <= -2e+142) {
tmp = t_1;
} else if ((1.0 - z) <= 1.0) {
tmp = t_0;
} else if ((1.0 - z) <= 1.0002) {
tmp = x + y;
} else if (((1.0 - z) <= 5e+86) || (!((1.0 - z) <= 4e+113) && (((1.0 - z) <= 2e+182) || !((1.0 - z) <= 2e+267)))) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = y * (1.0 - z) t_1 = x * -z tmp = 0 if (1.0 - z) <= -1e+209: tmp = y * -z elif (1.0 - z) <= -2e+142: tmp = t_1 elif (1.0 - z) <= 1.0: tmp = t_0 elif (1.0 - z) <= 1.0002: tmp = x + y elif ((1.0 - z) <= 5e+86) or (not ((1.0 - z) <= 4e+113) and (((1.0 - z) <= 2e+182) or not ((1.0 - z) <= 2e+267))): tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(y * Float64(1.0 - z)) t_1 = Float64(x * Float64(-z)) tmp = 0.0 if (Float64(1.0 - z) <= -1e+209) tmp = Float64(y * Float64(-z)); elseif (Float64(1.0 - z) <= -2e+142) tmp = t_1; elseif (Float64(1.0 - z) <= 1.0) tmp = t_0; elseif (Float64(1.0 - z) <= 1.0002) tmp = Float64(x + y); elseif ((Float64(1.0 - z) <= 5e+86) || (!(Float64(1.0 - z) <= 4e+113) && ((Float64(1.0 - z) <= 2e+182) || !(Float64(1.0 - z) <= 2e+267)))) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (1.0 - z); t_1 = x * -z; tmp = 0.0; if ((1.0 - z) <= -1e+209) tmp = y * -z; elseif ((1.0 - z) <= -2e+142) tmp = t_1; elseif ((1.0 - z) <= 1.0) tmp = t_0; elseif ((1.0 - z) <= 1.0002) tmp = x + y; elseif (((1.0 - z) <= 5e+86) || (~(((1.0 - z) <= 4e+113)) && (((1.0 - z) <= 2e+182) || ~(((1.0 - z) <= 2e+267))))) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * (-z)), $MachinePrecision]}, If[LessEqual[N[(1.0 - z), $MachinePrecision], -1e+209], N[(y * (-z)), $MachinePrecision], If[LessEqual[N[(1.0 - z), $MachinePrecision], -2e+142], t$95$1, If[LessEqual[N[(1.0 - z), $MachinePrecision], 1.0], t$95$0, If[LessEqual[N[(1.0 - z), $MachinePrecision], 1.0002], N[(x + y), $MachinePrecision], If[Or[LessEqual[N[(1.0 - z), $MachinePrecision], 5e+86], And[N[Not[LessEqual[N[(1.0 - z), $MachinePrecision], 4e+113]], $MachinePrecision], Or[LessEqual[N[(1.0 - z), $MachinePrecision], 2e+182], N[Not[LessEqual[N[(1.0 - z), $MachinePrecision], 2e+267]], $MachinePrecision]]]], t$95$0, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(1 - z\right)\\
t_1 := x \cdot \left(-z\right)\\
\mathbf{if}\;1 - z \leq -1 \cdot 10^{+209}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{elif}\;1 - z \leq -2 \cdot 10^{+142}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;1 - z \leq 1:\\
\;\;\;\;t_0\\
\mathbf{elif}\;1 - z \leq 1.0002:\\
\;\;\;\;x + y\\
\mathbf{elif}\;1 - z \leq 5 \cdot 10^{+86} \lor \neg \left(1 - z \leq 4 \cdot 10^{+113}\right) \land \left(1 - z \leq 2 \cdot 10^{+182} \lor \neg \left(1 - z \leq 2 \cdot 10^{+267}\right)\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (-.f64 1 z) < -1.0000000000000001e209Initial program 100.0%
Taylor expanded in z around inf 100.0%
mul-1-neg100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 55.1%
associate-*r*55.1%
mul-1-neg55.1%
Simplified55.1%
if -1.0000000000000001e209 < (-.f64 1 z) < -2.0000000000000001e142 or 4.9999999999999998e86 < (-.f64 1 z) < 4e113 or 2.0000000000000001e182 < (-.f64 1 z) < 1.9999999999999999e267Initial program 100.0%
Taylor expanded in x around inf 53.2%
*-commutative53.2%
Simplified53.2%
Taylor expanded in z around inf 53.2%
associate-*r*100.0%
mul-1-neg100.0%
Simplified53.2%
if -2.0000000000000001e142 < (-.f64 1 z) < 1 or 1.0002 < (-.f64 1 z) < 4.9999999999999998e86 or 4e113 < (-.f64 1 z) < 2.0000000000000001e182 or 1.9999999999999999e267 < (-.f64 1 z) Initial program 100.0%
Taylor expanded in x around 0 54.0%
if 1 < (-.f64 1 z) < 1.0002Initial program 100.0%
Taylor expanded in z around 0 86.6%
+-commutative86.6%
Simplified86.6%
Final simplification54.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (- z))) (t_1 (* x (- z))))
(if (<= z -2.15e+269)
t_0
(if (<= z -3e+184)
t_1
(if (<= z -5.2e+113)
t_0
(if (<= z -8.2e+89)
t_1
(if (<= z -19.0)
t_0
(if (<= z 1.0)
(+ x y)
(if (or (<= z 8e+138) (not (<= z 1.95e+208))) t_0 t_1)))))))))
double code(double x, double y, double z) {
double t_0 = y * -z;
double t_1 = x * -z;
double tmp;
if (z <= -2.15e+269) {
tmp = t_0;
} else if (z <= -3e+184) {
tmp = t_1;
} else if (z <= -5.2e+113) {
tmp = t_0;
} else if (z <= -8.2e+89) {
tmp = t_1;
} else if (z <= -19.0) {
tmp = t_0;
} else if (z <= 1.0) {
tmp = x + y;
} else if ((z <= 8e+138) || !(z <= 1.95e+208)) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = y * -z
t_1 = x * -z
if (z <= (-2.15d+269)) then
tmp = t_0
else if (z <= (-3d+184)) then
tmp = t_1
else if (z <= (-5.2d+113)) then
tmp = t_0
else if (z <= (-8.2d+89)) then
tmp = t_1
else if (z <= (-19.0d0)) then
tmp = t_0
else if (z <= 1.0d0) then
tmp = x + y
else if ((z <= 8d+138) .or. (.not. (z <= 1.95d+208))) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * -z;
double t_1 = x * -z;
double tmp;
if (z <= -2.15e+269) {
tmp = t_0;
} else if (z <= -3e+184) {
tmp = t_1;
} else if (z <= -5.2e+113) {
tmp = t_0;
} else if (z <= -8.2e+89) {
tmp = t_1;
} else if (z <= -19.0) {
tmp = t_0;
} else if (z <= 1.0) {
tmp = x + y;
} else if ((z <= 8e+138) || !(z <= 1.95e+208)) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = y * -z t_1 = x * -z tmp = 0 if z <= -2.15e+269: tmp = t_0 elif z <= -3e+184: tmp = t_1 elif z <= -5.2e+113: tmp = t_0 elif z <= -8.2e+89: tmp = t_1 elif z <= -19.0: tmp = t_0 elif z <= 1.0: tmp = x + y elif (z <= 8e+138) or not (z <= 1.95e+208): tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(y * Float64(-z)) t_1 = Float64(x * Float64(-z)) tmp = 0.0 if (z <= -2.15e+269) tmp = t_0; elseif (z <= -3e+184) tmp = t_1; elseif (z <= -5.2e+113) tmp = t_0; elseif (z <= -8.2e+89) tmp = t_1; elseif (z <= -19.0) tmp = t_0; elseif (z <= 1.0) tmp = Float64(x + y); elseif ((z <= 8e+138) || !(z <= 1.95e+208)) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * -z; t_1 = x * -z; tmp = 0.0; if (z <= -2.15e+269) tmp = t_0; elseif (z <= -3e+184) tmp = t_1; elseif (z <= -5.2e+113) tmp = t_0; elseif (z <= -8.2e+89) tmp = t_1; elseif (z <= -19.0) tmp = t_0; elseif (z <= 1.0) tmp = x + y; elseif ((z <= 8e+138) || ~((z <= 1.95e+208))) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * (-z)), $MachinePrecision]}, Block[{t$95$1 = N[(x * (-z)), $MachinePrecision]}, If[LessEqual[z, -2.15e+269], t$95$0, If[LessEqual[z, -3e+184], t$95$1, If[LessEqual[z, -5.2e+113], t$95$0, If[LessEqual[z, -8.2e+89], t$95$1, If[LessEqual[z, -19.0], t$95$0, If[LessEqual[z, 1.0], N[(x + y), $MachinePrecision], If[Or[LessEqual[z, 8e+138], N[Not[LessEqual[z, 1.95e+208]], $MachinePrecision]], t$95$0, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(-z\right)\\
t_1 := x \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -2.15 \cdot 10^{+269}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -3 \cdot 10^{+184}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -5.2 \cdot 10^{+113}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -8.2 \cdot 10^{+89}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -19:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+138} \lor \neg \left(z \leq 1.95 \cdot 10^{+208}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -2.14999999999999992e269 or -2.99999999999999986e184 < z < -5.1999999999999998e113 or -8.1999999999999997e89 < z < -19 or 1 < z < 8.0000000000000003e138 or 1.95e208 < z Initial program 100.0%
Taylor expanded in z around inf 96.2%
mul-1-neg96.2%
*-commutative96.2%
distribute-rgt-neg-out96.2%
+-commutative96.2%
Simplified96.2%
Taylor expanded in y around inf 48.0%
associate-*r*48.0%
mul-1-neg48.0%
Simplified48.0%
if -2.14999999999999992e269 < z < -2.99999999999999986e184 or -5.1999999999999998e113 < z < -8.1999999999999997e89 or 8.0000000000000003e138 < z < 1.95e208Initial program 100.0%
Taylor expanded in x around inf 53.2%
*-commutative53.2%
Simplified53.2%
Taylor expanded in z around inf 53.2%
associate-*r*100.0%
mul-1-neg100.0%
Simplified53.2%
if -19 < z < 1Initial program 100.0%
Taylor expanded in z around 0 97.5%
+-commutative97.5%
Simplified97.5%
Final simplification74.3%
(FPCore (x y z) :precision binary64 (if (or (<= (- 1.0 z) -5000.0) (not (<= (- 1.0 z) 2.0))) (* z (- (- y) x)) (+ x y)))
double code(double x, double y, double z) {
double tmp;
if (((1.0 - z) <= -5000.0) || !((1.0 - z) <= 2.0)) {
tmp = z * (-y - x);
} else {
tmp = x + y;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (((1.0d0 - z) <= (-5000.0d0)) .or. (.not. ((1.0d0 - z) <= 2.0d0))) then
tmp = z * (-y - x)
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (((1.0 - z) <= -5000.0) || !((1.0 - z) <= 2.0)) {
tmp = z * (-y - x);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((1.0 - z) <= -5000.0) or not ((1.0 - z) <= 2.0): tmp = z * (-y - x) else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(1.0 - z) <= -5000.0) || !(Float64(1.0 - z) <= 2.0)) tmp = Float64(z * Float64(Float64(-y) - x)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((1.0 - z) <= -5000.0) || ~(((1.0 - z) <= 2.0))) tmp = z * (-y - x); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[N[(1.0 - z), $MachinePrecision], -5000.0], N[Not[LessEqual[N[(1.0 - z), $MachinePrecision], 2.0]], $MachinePrecision]], N[(z * N[((-y) - x), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;1 - z \leq -5000 \lor \neg \left(1 - z \leq 2\right):\\
\;\;\;\;z \cdot \left(\left(-y\right) - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if (-.f64 1 z) < -5e3 or 2 < (-.f64 1 z) Initial program 100.0%
Taylor expanded in z around inf 97.6%
mul-1-neg97.6%
*-commutative97.6%
distribute-rgt-neg-out97.6%
+-commutative97.6%
Simplified97.6%
if -5e3 < (-.f64 1 z) < 2Initial program 100.0%
Taylor expanded in z around 0 97.5%
+-commutative97.5%
Simplified97.5%
Final simplification97.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -12600.0) (not (<= z 1.0))) (* x (- z)) (+ x y)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -12600.0) || !(z <= 1.0)) {
tmp = x * -z;
} else {
tmp = x + y;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-12600.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = x * -z
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -12600.0) || !(z <= 1.0)) {
tmp = x * -z;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -12600.0) or not (z <= 1.0): tmp = x * -z else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -12600.0) || !(z <= 1.0)) tmp = Float64(x * Float64(-z)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -12600.0) || ~((z <= 1.0))) tmp = x * -z; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -12600.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x * (-z)), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -12600 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -12600 or 1 < z Initial program 100.0%
Taylor expanded in x around inf 55.1%
*-commutative55.1%
Simplified55.1%
Taylor expanded in z around inf 55.1%
associate-*r*98.3%
mul-1-neg98.3%
Simplified55.1%
if -12600 < z < 1Initial program 100.0%
Taylor expanded in z around 0 96.2%
+-commutative96.2%
Simplified96.2%
Final simplification76.5%
(FPCore (x y z) :precision binary64 (if (<= y 1.45e-127) (* x (- 1.0 z)) (* y (- 1.0 z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.45e-127) {
tmp = x * (1.0 - z);
} else {
tmp = y * (1.0 - z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 1.45d-127) then
tmp = x * (1.0d0 - z)
else
tmp = y * (1.0d0 - z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.45e-127) {
tmp = x * (1.0 - z);
} else {
tmp = y * (1.0 - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.45e-127: tmp = x * (1.0 - z) else: tmp = y * (1.0 - z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.45e-127) tmp = Float64(x * Float64(1.0 - z)); else tmp = Float64(y * Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.45e-127) tmp = x * (1.0 - z); else tmp = y * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.45e-127], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.45 \cdot 10^{-127}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < 1.45e-127Initial program 100.0%
Taylor expanded in x around inf 60.2%
*-commutative60.2%
Simplified60.2%
if 1.45e-127 < y Initial program 100.0%
Taylor expanded in x around 0 72.9%
Final simplification64.8%
(FPCore (x y z) :precision binary64 (if (<= y 3.9e-97) x y))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.9e-97) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 3.9d-97) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3.9e-97) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.9e-97: tmp = x else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3.9e-97) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3.9e-97) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.9e-97], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.9 \cdot 10^{-97}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < 3.8999999999999998e-97Initial program 100.0%
Taylor expanded in x around inf 59.1%
*-commutative59.1%
Simplified59.1%
Taylor expanded in z around 0 29.1%
if 3.8999999999999998e-97 < y Initial program 100.0%
*-commutative100.0%
+-commutative100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 86.8%
associate-*r*86.8%
mul-1-neg86.8%
Simplified86.8%
Taylor expanded in z around 0 36.1%
Final simplification31.5%
(FPCore (x y z) :precision binary64 (+ x y))
double code(double x, double y, double z) {
return x + y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + y
end function
public static double code(double x, double y, double z) {
return x + y;
}
def code(x, y, z): return x + y
function code(x, y, z) return Float64(x + y) end
function tmp = code(x, y, z) tmp = x + y; end
code[x_, y_, z_] := N[(x + y), $MachinePrecision]
\begin{array}{l}
\\
x + y
\end{array}
Initial program 100.0%
Taylor expanded in z around 0 51.6%
+-commutative51.6%
Simplified51.6%
Final simplification51.6%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in x around inf 50.1%
*-commutative50.1%
Simplified50.1%
Taylor expanded in z around 0 24.4%
Final simplification24.4%
herbie shell --seed 2023322
(FPCore (x y z)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, H"
:precision binary64
(* (+ x y) (- 1.0 z)))