
(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 10 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 (- (+ x y) (* z (+ x y))))
double code(double x, double y, double z) {
return (x + y) - (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 = (x + y) - (z * (x + y))
end function
public static double code(double x, double y, double z) {
return (x + y) - (z * (x + y));
}
def code(x, y, z): return (x + y) - (z * (x + y))
function code(x, y, z) return Float64(Float64(x + y) - Float64(z * Float64(x + y))) end
function tmp = code(x, y, z) tmp = (x + y) - (z * (x + y)); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] - N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) - z \cdot \left(x + y\right)
\end{array}
Initial program 100.0%
sub-neg100.0%
distribute-lft-in100.0%
*-commutative100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (- z))) (t_1 (* y (- 1.0 z))))
(if (<= z -4.1e+195)
t_0
(if (<= z -2.2e-6)
t_1
(if (<= z 5.8e-14)
(+ x y)
(if (or (<= z 4e+45) (and (not (<= z 3e+81)) (<= z 3.55e+148)))
t_1
t_0))))))
double code(double x, double y, double z) {
double t_0 = x * -z;
double t_1 = y * (1.0 - z);
double tmp;
if (z <= -4.1e+195) {
tmp = t_0;
} else if (z <= -2.2e-6) {
tmp = t_1;
} else if (z <= 5.8e-14) {
tmp = x + y;
} else if ((z <= 4e+45) || (!(z <= 3e+81) && (z <= 3.55e+148))) {
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 = x * -z
t_1 = y * (1.0d0 - z)
if (z <= (-4.1d+195)) then
tmp = t_0
else if (z <= (-2.2d-6)) then
tmp = t_1
else if (z <= 5.8d-14) then
tmp = x + y
else if ((z <= 4d+45) .or. (.not. (z <= 3d+81)) .and. (z <= 3.55d+148)) 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 = x * -z;
double t_1 = y * (1.0 - z);
double tmp;
if (z <= -4.1e+195) {
tmp = t_0;
} else if (z <= -2.2e-6) {
tmp = t_1;
} else if (z <= 5.8e-14) {
tmp = x + y;
} else if ((z <= 4e+45) || (!(z <= 3e+81) && (z <= 3.55e+148))) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * -z t_1 = y * (1.0 - z) tmp = 0 if z <= -4.1e+195: tmp = t_0 elif z <= -2.2e-6: tmp = t_1 elif z <= 5.8e-14: tmp = x + y elif (z <= 4e+45) or (not (z <= 3e+81) and (z <= 3.55e+148)): tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(-z)) t_1 = Float64(y * Float64(1.0 - z)) tmp = 0.0 if (z <= -4.1e+195) tmp = t_0; elseif (z <= -2.2e-6) tmp = t_1; elseif (z <= 5.8e-14) tmp = Float64(x + y); elseif ((z <= 4e+45) || (!(z <= 3e+81) && (z <= 3.55e+148))) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * -z; t_1 = y * (1.0 - z); tmp = 0.0; if (z <= -4.1e+195) tmp = t_0; elseif (z <= -2.2e-6) tmp = t_1; elseif (z <= 5.8e-14) tmp = x + y; elseif ((z <= 4e+45) || (~((z <= 3e+81)) && (z <= 3.55e+148))) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * (-z)), $MachinePrecision]}, Block[{t$95$1 = N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.1e+195], t$95$0, If[LessEqual[z, -2.2e-6], t$95$1, If[LessEqual[z, 5.8e-14], N[(x + y), $MachinePrecision], If[Or[LessEqual[z, 4e+45], And[N[Not[LessEqual[z, 3e+81]], $MachinePrecision], LessEqual[z, 3.55e+148]]], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(-z\right)\\
t_1 := y \cdot \left(1 - z\right)\\
\mathbf{if}\;z \leq -4.1 \cdot 10^{+195}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -2.2 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-14}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+45} \lor \neg \left(z \leq 3 \cdot 10^{+81}\right) \land z \leq 3.55 \cdot 10^{+148}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -4.1e195 or 3.9999999999999997e45 < z < 2.99999999999999997e81 or 3.5500000000000003e148 < z Initial program 100.0%
Taylor expanded in z around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in x around inf 59.7%
associate-*r*59.7%
mul-1-neg59.7%
Simplified59.7%
if -4.1e195 < z < -2.2000000000000001e-6 or 5.8000000000000005e-14 < z < 3.9999999999999997e45 or 2.99999999999999997e81 < z < 3.5500000000000003e148Initial program 100.0%
Taylor expanded in x around 0 53.5%
if -2.2000000000000001e-6 < z < 5.8000000000000005e-14Initial program 100.0%
Taylor expanded in z around 0 99.2%
+-commutative99.2%
Simplified99.2%
Final simplification77.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (- z))) (t_1 (* y (- z))))
(if (<= z -8.8e+192)
t_0
(if (<= z -31.0)
t_1
(if (<= z 1.0)
(+ x y)
(if (or (<= z 4.4e+44) (and (not (<= z 1.32e+85)) (<= z 2.1e+147)))
t_1
t_0))))))
double code(double x, double y, double z) {
double t_0 = x * -z;
double t_1 = y * -z;
double tmp;
if (z <= -8.8e+192) {
tmp = t_0;
} else if (z <= -31.0) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = x + y;
} else if ((z <= 4.4e+44) || (!(z <= 1.32e+85) && (z <= 2.1e+147))) {
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 = x * -z
t_1 = y * -z
if (z <= (-8.8d+192)) then
tmp = t_0
else if (z <= (-31.0d0)) then
tmp = t_1
else if (z <= 1.0d0) then
tmp = x + y
else if ((z <= 4.4d+44) .or. (.not. (z <= 1.32d+85)) .and. (z <= 2.1d+147)) 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 = x * -z;
double t_1 = y * -z;
double tmp;
if (z <= -8.8e+192) {
tmp = t_0;
} else if (z <= -31.0) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = x + y;
} else if ((z <= 4.4e+44) || (!(z <= 1.32e+85) && (z <= 2.1e+147))) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * -z t_1 = y * -z tmp = 0 if z <= -8.8e+192: tmp = t_0 elif z <= -31.0: tmp = t_1 elif z <= 1.0: tmp = x + y elif (z <= 4.4e+44) or (not (z <= 1.32e+85) and (z <= 2.1e+147)): tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(-z)) t_1 = Float64(y * Float64(-z)) tmp = 0.0 if (z <= -8.8e+192) tmp = t_0; elseif (z <= -31.0) tmp = t_1; elseif (z <= 1.0) tmp = Float64(x + y); elseif ((z <= 4.4e+44) || (!(z <= 1.32e+85) && (z <= 2.1e+147))) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * -z; t_1 = y * -z; tmp = 0.0; if (z <= -8.8e+192) tmp = t_0; elseif (z <= -31.0) tmp = t_1; elseif (z <= 1.0) tmp = x + y; elseif ((z <= 4.4e+44) || (~((z <= 1.32e+85)) && (z <= 2.1e+147))) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * (-z)), $MachinePrecision]}, Block[{t$95$1 = N[(y * (-z)), $MachinePrecision]}, If[LessEqual[z, -8.8e+192], t$95$0, If[LessEqual[z, -31.0], t$95$1, If[LessEqual[z, 1.0], N[(x + y), $MachinePrecision], If[Or[LessEqual[z, 4.4e+44], And[N[Not[LessEqual[z, 1.32e+85]], $MachinePrecision], LessEqual[z, 2.1e+147]]], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(-z\right)\\
t_1 := y \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -8.8 \cdot 10^{+192}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -31:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+44} \lor \neg \left(z \leq 1.32 \cdot 10^{+85}\right) \land z \leq 2.1 \cdot 10^{+147}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -8.8000000000000003e192 or 4.39999999999999991e44 < z < 1.32000000000000007e85 or 2.10000000000000006e147 < z Initial program 100.0%
Taylor expanded in z around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in x around inf 59.7%
associate-*r*59.7%
mul-1-neg59.7%
Simplified59.7%
if -8.8000000000000003e192 < z < -31 or 1 < z < 4.39999999999999991e44 or 1.32000000000000007e85 < z < 2.10000000000000006e147Initial program 100.0%
Taylor expanded in z around inf 98.7%
neg-mul-198.7%
Simplified98.7%
Taylor expanded in x around 0 53.3%
associate-*r*53.3%
mul-1-neg53.3%
Simplified53.3%
if -31 < z < 1Initial program 100.0%
Taylor expanded in z around 0 97.6%
+-commutative97.6%
Simplified97.6%
Final simplification77.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (- 1.0 z))))
(if (<= x -105000000.0)
t_0
(if (<= x -1e-115) (+ x y) (if (<= x -1.5e-123) t_0 (* y (- 1.0 z)))))))
double code(double x, double y, double z) {
double t_0 = x * (1.0 - z);
double tmp;
if (x <= -105000000.0) {
tmp = t_0;
} else if (x <= -1e-115) {
tmp = x + y;
} else if (x <= -1.5e-123) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = x * (1.0d0 - z)
if (x <= (-105000000.0d0)) then
tmp = t_0
else if (x <= (-1d-115)) then
tmp = x + y
else if (x <= (-1.5d-123)) then
tmp = t_0
else
tmp = y * (1.0d0 - z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (1.0 - z);
double tmp;
if (x <= -105000000.0) {
tmp = t_0;
} else if (x <= -1e-115) {
tmp = x + y;
} else if (x <= -1.5e-123) {
tmp = t_0;
} else {
tmp = y * (1.0 - z);
}
return tmp;
}
def code(x, y, z): t_0 = x * (1.0 - z) tmp = 0 if x <= -105000000.0: tmp = t_0 elif x <= -1e-115: tmp = x + y elif x <= -1.5e-123: tmp = t_0 else: tmp = y * (1.0 - z) return tmp
function code(x, y, z) t_0 = Float64(x * Float64(1.0 - z)) tmp = 0.0 if (x <= -105000000.0) tmp = t_0; elseif (x <= -1e-115) tmp = Float64(x + y); elseif (x <= -1.5e-123) tmp = t_0; else tmp = Float64(y * Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (1.0 - z); tmp = 0.0; if (x <= -105000000.0) tmp = t_0; elseif (x <= -1e-115) tmp = x + y; elseif (x <= -1.5e-123) tmp = t_0; else tmp = y * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -105000000.0], t$95$0, If[LessEqual[x, -1e-115], N[(x + y), $MachinePrecision], If[LessEqual[x, -1.5e-123], t$95$0, N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(1 - z\right)\\
\mathbf{if}\;x \leq -105000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1 \cdot 10^{-115}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;x \leq -1.5 \cdot 10^{-123}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if x < -1.05e8 or -1.0000000000000001e-115 < x < -1.49999999999999992e-123Initial program 100.0%
Taylor expanded in x around inf 85.5%
*-commutative85.5%
Simplified85.5%
if -1.05e8 < x < -1.0000000000000001e-115Initial program 99.9%
Taylor expanded in z around 0 73.5%
+-commutative73.5%
Simplified73.5%
if -1.49999999999999992e-123 < x Initial program 100.0%
Taylor expanded in x around 0 61.5%
Final simplification68.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -340000.0) (not (<= z 1.0))) (* x (- z)) (+ x y)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -340000.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 <= (-340000.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 <= -340000.0) || !(z <= 1.0)) {
tmp = x * -z;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -340000.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 <= -340000.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 <= -340000.0) || ~((z <= 1.0))) tmp = x * -z; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -340000.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 -340000 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -3.4e5 or 1 < z Initial program 100.0%
Taylor expanded in z around inf 99.8%
neg-mul-199.8%
Simplified99.8%
Taylor expanded in x around inf 54.0%
associate-*r*54.0%
mul-1-neg54.0%
Simplified54.0%
if -3.4e5 < z < 1Initial program 100.0%
Taylor expanded in z around 0 96.9%
+-commutative96.9%
Simplified96.9%
Final simplification75.4%
(FPCore (x y z) :precision binary64 (if (<= (+ x y) -4e-236) (- x (* x z)) (- y (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x + y) <= -4e-236) {
tmp = x - (x * z);
} else {
tmp = y - (y * 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 + y) <= (-4d-236)) then
tmp = x - (x * z)
else
tmp = y - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x + y) <= -4e-236) {
tmp = x - (x * z);
} else {
tmp = y - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x + y) <= -4e-236: tmp = x - (x * z) else: tmp = y - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(x + y) <= -4e-236) tmp = Float64(x - Float64(x * z)); else tmp = Float64(y - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x + y) <= -4e-236) tmp = x - (x * z); else tmp = y - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(x + y), $MachinePrecision], -4e-236], N[(x - N[(x * z), $MachinePrecision]), $MachinePrecision], N[(y - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -4 \cdot 10^{-236}:\\
\;\;\;\;x - x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y - y \cdot z\\
\end{array}
\end{array}
if (+.f64 x y) < -4.0000000000000002e-236Initial program 100.0%
Taylor expanded in x around inf 54.4%
*-commutative54.4%
Simplified54.4%
Taylor expanded in z around 0 54.4%
associate-*r*54.4%
mul-1-neg54.4%
Simplified54.4%
distribute-lft-neg-out54.4%
unsub-neg54.4%
*-commutative54.4%
Applied egg-rr54.4%
if -4.0000000000000002e-236 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0 51.8%
Taylor expanded in z around 0 51.8%
associate-*r*51.8%
mul-1-neg51.8%
Simplified51.8%
distribute-lft-neg-out51.8%
unsub-neg51.8%
*-commutative51.8%
Applied egg-rr51.8%
Final simplification53.1%
(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 (if (<= x -4.1e-132) x y))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.1e-132) {
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 (x <= (-4.1d-132)) 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 (x <= -4.1e-132) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.1e-132: tmp = x else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.1e-132) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4.1e-132) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.1e-132], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.1 \cdot 10^{-132}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if x < -4.10000000000000007e-132Initial program 100.0%
Taylor expanded in x around inf 74.5%
*-commutative74.5%
Simplified74.5%
Taylor expanded in z around 0 36.6%
if -4.10000000000000007e-132 < x Initial program 100.0%
Taylor expanded in x around 0 61.3%
Taylor expanded in z around 0 31.2%
(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 50.2%
+-commutative50.2%
Simplified50.2%
Final simplification50.2%
(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 52.5%
*-commutative52.5%
Simplified52.5%
Taylor expanded in z around 0 26.0%
herbie shell --seed 2024111
(FPCore (x y z)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, H"
:precision binary64
(* (+ x y) (- 1.0 z)))