
(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 8 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 (* z (- y))) (t_2 (* z (- x))))
(if (<= (- 1.0 z) -5e+82)
t_1
(if (<= (- 1.0 z) -2e+46)
t_2
(if (<= (- 1.0 z) 0.8)
t_0
(if (<= (- 1.0 z) 2.0)
(+ x y)
(if (<= (- 1.0 z) 1e+45)
t_0
(if (or (<= (- 1.0 z) 1e+150) (not (<= (- 1.0 z) 1e+175)))
t_2
t_1))))))))
double code(double x, double y, double z) {
double t_0 = y * (1.0 - z);
double t_1 = z * -y;
double t_2 = z * -x;
double tmp;
if ((1.0 - z) <= -5e+82) {
tmp = t_1;
} else if ((1.0 - z) <= -2e+46) {
tmp = t_2;
} else if ((1.0 - z) <= 0.8) {
tmp = t_0;
} else if ((1.0 - z) <= 2.0) {
tmp = x + y;
} else if ((1.0 - z) <= 1e+45) {
tmp = t_0;
} else if (((1.0 - z) <= 1e+150) || !((1.0 - z) <= 1e+175)) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_0 = y * (1.0d0 - z)
t_1 = z * -y
t_2 = z * -x
if ((1.0d0 - z) <= (-5d+82)) then
tmp = t_1
else if ((1.0d0 - z) <= (-2d+46)) then
tmp = t_2
else if ((1.0d0 - z) <= 0.8d0) then
tmp = t_0
else if ((1.0d0 - z) <= 2.0d0) then
tmp = x + y
else if ((1.0d0 - z) <= 1d+45) then
tmp = t_0
else if (((1.0d0 - z) <= 1d+150) .or. (.not. ((1.0d0 - z) <= 1d+175))) then
tmp = t_2
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 = z * -y;
double t_2 = z * -x;
double tmp;
if ((1.0 - z) <= -5e+82) {
tmp = t_1;
} else if ((1.0 - z) <= -2e+46) {
tmp = t_2;
} else if ((1.0 - z) <= 0.8) {
tmp = t_0;
} else if ((1.0 - z) <= 2.0) {
tmp = x + y;
} else if ((1.0 - z) <= 1e+45) {
tmp = t_0;
} else if (((1.0 - z) <= 1e+150) || !((1.0 - z) <= 1e+175)) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = y * (1.0 - z) t_1 = z * -y t_2 = z * -x tmp = 0 if (1.0 - z) <= -5e+82: tmp = t_1 elif (1.0 - z) <= -2e+46: tmp = t_2 elif (1.0 - z) <= 0.8: tmp = t_0 elif (1.0 - z) <= 2.0: tmp = x + y elif (1.0 - z) <= 1e+45: tmp = t_0 elif ((1.0 - z) <= 1e+150) or not ((1.0 - z) <= 1e+175): tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(y * Float64(1.0 - z)) t_1 = Float64(z * Float64(-y)) t_2 = Float64(z * Float64(-x)) tmp = 0.0 if (Float64(1.0 - z) <= -5e+82) tmp = t_1; elseif (Float64(1.0 - z) <= -2e+46) tmp = t_2; elseif (Float64(1.0 - z) <= 0.8) tmp = t_0; elseif (Float64(1.0 - z) <= 2.0) tmp = Float64(x + y); elseif (Float64(1.0 - z) <= 1e+45) tmp = t_0; elseif ((Float64(1.0 - z) <= 1e+150) || !(Float64(1.0 - z) <= 1e+175)) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (1.0 - z); t_1 = z * -y; t_2 = z * -x; tmp = 0.0; if ((1.0 - z) <= -5e+82) tmp = t_1; elseif ((1.0 - z) <= -2e+46) tmp = t_2; elseif ((1.0 - z) <= 0.8) tmp = t_0; elseif ((1.0 - z) <= 2.0) tmp = x + y; elseif ((1.0 - z) <= 1e+45) tmp = t_0; elseif (((1.0 - z) <= 1e+150) || ~(((1.0 - z) <= 1e+175))) tmp = t_2; 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[(z * (-y)), $MachinePrecision]}, Block[{t$95$2 = N[(z * (-x)), $MachinePrecision]}, If[LessEqual[N[(1.0 - z), $MachinePrecision], -5e+82], t$95$1, If[LessEqual[N[(1.0 - z), $MachinePrecision], -2e+46], t$95$2, If[LessEqual[N[(1.0 - z), $MachinePrecision], 0.8], t$95$0, If[LessEqual[N[(1.0 - z), $MachinePrecision], 2.0], N[(x + y), $MachinePrecision], If[LessEqual[N[(1.0 - z), $MachinePrecision], 1e+45], t$95$0, If[Or[LessEqual[N[(1.0 - z), $MachinePrecision], 1e+150], N[Not[LessEqual[N[(1.0 - z), $MachinePrecision], 1e+175]], $MachinePrecision]], t$95$2, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(1 - z\right)\\
t_1 := z \cdot \left(-y\right)\\
t_2 := z \cdot \left(-x\right)\\
\mathbf{if}\;1 - z \leq -5 \cdot 10^{+82}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;1 - z \leq -2 \cdot 10^{+46}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;1 - z \leq 0.8:\\
\;\;\;\;t_0\\
\mathbf{elif}\;1 - z \leq 2:\\
\;\;\;\;x + y\\
\mathbf{elif}\;1 - z \leq 10^{+45}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;1 - z \leq 10^{+150} \lor \neg \left(1 - z \leq 10^{+175}\right):\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (-.f64 1 z) < -5.00000000000000015e82 or 9.99999999999999981e149 < (-.f64 1 z) < 9.9999999999999994e174Initial program 100.0%
Taylor expanded in x around 0 55.6%
Taylor expanded in z around inf 55.6%
associate-*r*55.6%
mul-1-neg55.6%
Simplified55.6%
if -5.00000000000000015e82 < (-.f64 1 z) < -2e46 or 9.9999999999999993e44 < (-.f64 1 z) < 9.99999999999999981e149 or 9.9999999999999994e174 < (-.f64 1 z) Initial 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 0 59.2%
mul-1-neg59.2%
*-commutative59.2%
distribute-rgt-neg-in59.2%
Simplified59.2%
if -2e46 < (-.f64 1 z) < 0.80000000000000004 or 2 < (-.f64 1 z) < 9.9999999999999993e44Initial program 99.8%
Taylor expanded in x around 0 41.2%
if 0.80000000000000004 < (-.f64 1 z) < 2Initial program 100.0%
Taylor expanded in z around 0 97.2%
Final simplification72.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- x))) (t_1 (* z (- y))))
(if (<= z -1.06e+175)
t_0
(if (<= z -3.05e+156)
t_1
(if (<= z -48000.0)
t_0
(if (<= z 1.0)
(+ x y)
(if (or (<= z 7.4e+34) (not (<= z 6.6e+79))) t_1 t_0)))))))
double code(double x, double y, double z) {
double t_0 = z * -x;
double t_1 = z * -y;
double tmp;
if (z <= -1.06e+175) {
tmp = t_0;
} else if (z <= -3.05e+156) {
tmp = t_1;
} else if (z <= -48000.0) {
tmp = t_0;
} else if (z <= 1.0) {
tmp = x + y;
} else if ((z <= 7.4e+34) || !(z <= 6.6e+79)) {
tmp = t_1;
} else {
tmp = t_0;
}
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 = z * -x
t_1 = z * -y
if (z <= (-1.06d+175)) then
tmp = t_0
else if (z <= (-3.05d+156)) then
tmp = t_1
else if (z <= (-48000.0d0)) then
tmp = t_0
else if (z <= 1.0d0) then
tmp = x + y
else if ((z <= 7.4d+34) .or. (.not. (z <= 6.6d+79))) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * -x;
double t_1 = z * -y;
double tmp;
if (z <= -1.06e+175) {
tmp = t_0;
} else if (z <= -3.05e+156) {
tmp = t_1;
} else if (z <= -48000.0) {
tmp = t_0;
} else if (z <= 1.0) {
tmp = x + y;
} else if ((z <= 7.4e+34) || !(z <= 6.6e+79)) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * -x t_1 = z * -y tmp = 0 if z <= -1.06e+175: tmp = t_0 elif z <= -3.05e+156: tmp = t_1 elif z <= -48000.0: tmp = t_0 elif z <= 1.0: tmp = x + y elif (z <= 7.4e+34) or not (z <= 6.6e+79): tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(-x)) t_1 = Float64(z * Float64(-y)) tmp = 0.0 if (z <= -1.06e+175) tmp = t_0; elseif (z <= -3.05e+156) tmp = t_1; elseif (z <= -48000.0) tmp = t_0; elseif (z <= 1.0) tmp = Float64(x + y); elseif ((z <= 7.4e+34) || !(z <= 6.6e+79)) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * -x; t_1 = z * -y; tmp = 0.0; if (z <= -1.06e+175) tmp = t_0; elseif (z <= -3.05e+156) tmp = t_1; elseif (z <= -48000.0) tmp = t_0; elseif (z <= 1.0) tmp = x + y; elseif ((z <= 7.4e+34) || ~((z <= 6.6e+79))) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * (-x)), $MachinePrecision]}, Block[{t$95$1 = N[(z * (-y)), $MachinePrecision]}, If[LessEqual[z, -1.06e+175], t$95$0, If[LessEqual[z, -3.05e+156], t$95$1, If[LessEqual[z, -48000.0], t$95$0, If[LessEqual[z, 1.0], N[(x + y), $MachinePrecision], If[Or[LessEqual[z, 7.4e+34], N[Not[LessEqual[z, 6.6e+79]], $MachinePrecision]], t$95$1, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(-x\right)\\
t_1 := z \cdot \left(-y\right)\\
\mathbf{if}\;z \leq -1.06 \cdot 10^{+175}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -3.05 \cdot 10^{+156}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -48000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 7.4 \cdot 10^{+34} \lor \neg \left(z \leq 6.6 \cdot 10^{+79}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -1.06e175 or -3.0500000000000001e156 < z < -48000 or 7.40000000000000017e34 < z < 6.6000000000000003e79Initial program 100.0%
Taylor expanded in z around inf 99.4%
mul-1-neg99.4%
+-commutative99.4%
distribute-rgt-neg-out99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in y around 0 58.5%
mul-1-neg58.5%
*-commutative58.5%
distribute-rgt-neg-in58.5%
Simplified58.5%
if -1.06e175 < z < -3.0500000000000001e156 or 1 < z < 7.40000000000000017e34 or 6.6000000000000003e79 < z Initial program 100.0%
Taylor expanded in x around 0 52.9%
Taylor expanded in z around inf 52.8%
associate-*r*52.8%
mul-1-neg52.8%
Simplified52.8%
if -48000 < z < 1Initial program 100.0%
Taylor expanded in z around 0 95.7%
Final simplification72.3%
(FPCore (x y z) :precision binary64 (if (or (<= (- 1.0 z) -5000000000000.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) <= -5000000000000.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) <= (-5000000000000.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) <= -5000000000000.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) <= -5000000000000.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) <= -5000000000000.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) <= -5000000000000.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], -5000000000000.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 -5000000000000 \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) < -5e12 or 2 < (-.f64 1 z) Initial program 100.0%
Taylor expanded in z around inf 99.0%
mul-1-neg99.0%
+-commutative99.0%
distribute-rgt-neg-out99.0%
+-commutative99.0%
Simplified99.0%
if -5e12 < (-.f64 1 z) < 2Initial program 100.0%
Taylor expanded in z around 0 96.5%
Final simplification98.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.1e-59) (and (not (<= x -1.15e-88)) (<= x -2.3e-117))) (- x (* x z)) (* y (- 1.0 z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.1e-59) || (!(x <= -1.15e-88) && (x <= -2.3e-117))) {
tmp = x - (x * 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 ((x <= (-2.1d-59)) .or. (.not. (x <= (-1.15d-88))) .and. (x <= (-2.3d-117))) then
tmp = x - (x * 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 ((x <= -2.1e-59) || (!(x <= -1.15e-88) && (x <= -2.3e-117))) {
tmp = x - (x * z);
} else {
tmp = y * (1.0 - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.1e-59) or (not (x <= -1.15e-88) and (x <= -2.3e-117)): tmp = x - (x * z) else: tmp = y * (1.0 - z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.1e-59) || (!(x <= -1.15e-88) && (x <= -2.3e-117))) tmp = Float64(x - Float64(x * z)); else tmp = Float64(y * Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.1e-59) || (~((x <= -1.15e-88)) && (x <= -2.3e-117))) tmp = x - (x * z); else tmp = y * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.1e-59], And[N[Not[LessEqual[x, -1.15e-88]], $MachinePrecision], LessEqual[x, -2.3e-117]]], N[(x - N[(x * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-59} \lor \neg \left(x \leq -1.15 \cdot 10^{-88}\right) \land x \leq -2.3 \cdot 10^{-117}:\\
\;\;\;\;x - x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if x < -2.09999999999999997e-59 or -1.14999999999999993e-88 < x < -2.29999999999999994e-117Initial program 99.9%
Taylor expanded in x around inf 77.0%
sub-neg77.0%
+-commutative77.0%
distribute-rgt1-in77.0%
distribute-lft-neg-out77.0%
unsub-neg77.0%
Simplified77.0%
if -2.09999999999999997e-59 < x < -1.14999999999999993e-88 or -2.29999999999999994e-117 < x Initial program 100.0%
Taylor expanded in x around 0 62.0%
Final simplification66.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -48000.0) (not (<= z 1.0))) (* z (- x)) (+ x y)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -48000.0) || !(z <= 1.0)) {
tmp = z * -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 ((z <= (-48000.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = z * -x
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -48000.0) || !(z <= 1.0)) {
tmp = z * -x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -48000.0) or not (z <= 1.0): tmp = z * -x else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -48000.0) || !(z <= 1.0)) tmp = Float64(z * Float64(-x)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -48000.0) || ~((z <= 1.0))) tmp = z * -x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -48000.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(z * (-x)), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -48000 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;z \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -48000 or 1 < z Initial program 100.0%
Taylor expanded in z around inf 99.4%
mul-1-neg99.4%
+-commutative99.4%
distribute-rgt-neg-out99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in y around 0 54.9%
mul-1-neg54.9%
*-commutative54.9%
distribute-rgt-neg-in54.9%
Simplified54.9%
if -48000 < z < 1Initial program 100.0%
Taylor expanded in z around 0 95.7%
Final simplification71.6%
(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 41.5%
Final simplification41.5%
(FPCore (x y z) :precision binary64 y)
double code(double x, double y, double z) {
return y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y
end function
public static double code(double x, double y, double z) {
return y;
}
def code(x, y, z): return y
function code(x, y, z) return y end
function tmp = code(x, y, z) tmp = y; end
code[x_, y_, z_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 50.6%
Taylor expanded in z around 0 22.4%
Final simplification22.4%
herbie shell --seed 2023274
(FPCore (x y z)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, H"
:precision binary64
(* (+ x y) (- 1.0 z)))