
(FPCore (x y z) :precision binary64 (+ (+ (+ (+ (+ x y) y) x) z) x))
double code(double x, double y, double z) {
return ((((x + y) + y) + x) + z) + 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 + y) + y) + x) + z) + x
end function
public static double code(double x, double y, double z) {
return ((((x + y) + y) + x) + z) + x;
}
def code(x, y, z): return ((((x + y) + y) + x) + z) + x
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x + y) + y) + x) + z) + x) end
function tmp = code(x, y, z) tmp = ((((x + y) + y) + x) + z) + x; end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision] + z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (+ (+ (+ (+ x y) y) x) z) x))
double code(double x, double y, double z) {
return ((((x + y) + y) + x) + z) + 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 + y) + y) + x) + z) + x
end function
public static double code(double x, double y, double z) {
return ((((x + y) + y) + x) + z) + x;
}
def code(x, y, z): return ((((x + y) + y) + x) + z) + x
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x + y) + y) + x) + z) + x) end
function tmp = code(x, y, z) tmp = ((((x + y) + y) + x) + z) + x; end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision] + z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x
\end{array}
(FPCore (x y z) :precision binary64 (- z (fma x -3.0 (* y -2.0))))
double code(double x, double y, double z) {
return z - fma(x, -3.0, (y * -2.0));
}
function code(x, y, z) return Float64(z - fma(x, -3.0, Float64(y * -2.0))) end
code[x_, y_, z_] := N[(z - N[(x * -3.0 + N[(y * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z - \mathsf{fma}\left(x, -3, y \cdot -2\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
unsub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
distribute-neg-in99.9%
distribute-neg-out99.9%
neg-mul-199.9%
count-299.9%
distribute-lft-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-rgt-out99.9%
distribute-neg-out99.9%
fma-define100.0%
Simplified100.0%
(FPCore (x y z)
:precision binary64
(if (<= y -3.2e+74)
(* y 2.0)
(if (<= y -3e-171)
z
(if (<= y -5.2e-205)
(* x 3.0)
(if (<= y -3.2e-251)
z
(if (<= y -4.2e-275)
(* x 3.0)
(if (<= y 4.7e-247)
z
(if (<= y 1.1e-226)
(* x 3.0)
(if (<= y 8.8e-167)
z
(if (<= y 5.8e-99)
(* x 3.0)
(if (<= y 1e-86)
z
(if (<= y 1.05e-26)
(* x 3.0)
(if (<= y 140000000.0) z (* y 2.0))))))))))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.2e+74) {
tmp = y * 2.0;
} else if (y <= -3e-171) {
tmp = z;
} else if (y <= -5.2e-205) {
tmp = x * 3.0;
} else if (y <= -3.2e-251) {
tmp = z;
} else if (y <= -4.2e-275) {
tmp = x * 3.0;
} else if (y <= 4.7e-247) {
tmp = z;
} else if (y <= 1.1e-226) {
tmp = x * 3.0;
} else if (y <= 8.8e-167) {
tmp = z;
} else if (y <= 5.8e-99) {
tmp = x * 3.0;
} else if (y <= 1e-86) {
tmp = z;
} else if (y <= 1.05e-26) {
tmp = x * 3.0;
} else if (y <= 140000000.0) {
tmp = z;
} else {
tmp = y * 2.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) :: tmp
if (y <= (-3.2d+74)) then
tmp = y * 2.0d0
else if (y <= (-3d-171)) then
tmp = z
else if (y <= (-5.2d-205)) then
tmp = x * 3.0d0
else if (y <= (-3.2d-251)) then
tmp = z
else if (y <= (-4.2d-275)) then
tmp = x * 3.0d0
else if (y <= 4.7d-247) then
tmp = z
else if (y <= 1.1d-226) then
tmp = x * 3.0d0
else if (y <= 8.8d-167) then
tmp = z
else if (y <= 5.8d-99) then
tmp = x * 3.0d0
else if (y <= 1d-86) then
tmp = z
else if (y <= 1.05d-26) then
tmp = x * 3.0d0
else if (y <= 140000000.0d0) then
tmp = z
else
tmp = y * 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.2e+74) {
tmp = y * 2.0;
} else if (y <= -3e-171) {
tmp = z;
} else if (y <= -5.2e-205) {
tmp = x * 3.0;
} else if (y <= -3.2e-251) {
tmp = z;
} else if (y <= -4.2e-275) {
tmp = x * 3.0;
} else if (y <= 4.7e-247) {
tmp = z;
} else if (y <= 1.1e-226) {
tmp = x * 3.0;
} else if (y <= 8.8e-167) {
tmp = z;
} else if (y <= 5.8e-99) {
tmp = x * 3.0;
} else if (y <= 1e-86) {
tmp = z;
} else if (y <= 1.05e-26) {
tmp = x * 3.0;
} else if (y <= 140000000.0) {
tmp = z;
} else {
tmp = y * 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.2e+74: tmp = y * 2.0 elif y <= -3e-171: tmp = z elif y <= -5.2e-205: tmp = x * 3.0 elif y <= -3.2e-251: tmp = z elif y <= -4.2e-275: tmp = x * 3.0 elif y <= 4.7e-247: tmp = z elif y <= 1.1e-226: tmp = x * 3.0 elif y <= 8.8e-167: tmp = z elif y <= 5.8e-99: tmp = x * 3.0 elif y <= 1e-86: tmp = z elif y <= 1.05e-26: tmp = x * 3.0 elif y <= 140000000.0: tmp = z else: tmp = y * 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.2e+74) tmp = Float64(y * 2.0); elseif (y <= -3e-171) tmp = z; elseif (y <= -5.2e-205) tmp = Float64(x * 3.0); elseif (y <= -3.2e-251) tmp = z; elseif (y <= -4.2e-275) tmp = Float64(x * 3.0); elseif (y <= 4.7e-247) tmp = z; elseif (y <= 1.1e-226) tmp = Float64(x * 3.0); elseif (y <= 8.8e-167) tmp = z; elseif (y <= 5.8e-99) tmp = Float64(x * 3.0); elseif (y <= 1e-86) tmp = z; elseif (y <= 1.05e-26) tmp = Float64(x * 3.0); elseif (y <= 140000000.0) tmp = z; else tmp = Float64(y * 2.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.2e+74) tmp = y * 2.0; elseif (y <= -3e-171) tmp = z; elseif (y <= -5.2e-205) tmp = x * 3.0; elseif (y <= -3.2e-251) tmp = z; elseif (y <= -4.2e-275) tmp = x * 3.0; elseif (y <= 4.7e-247) tmp = z; elseif (y <= 1.1e-226) tmp = x * 3.0; elseif (y <= 8.8e-167) tmp = z; elseif (y <= 5.8e-99) tmp = x * 3.0; elseif (y <= 1e-86) tmp = z; elseif (y <= 1.05e-26) tmp = x * 3.0; elseif (y <= 140000000.0) tmp = z; else tmp = y * 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.2e+74], N[(y * 2.0), $MachinePrecision], If[LessEqual[y, -3e-171], z, If[LessEqual[y, -5.2e-205], N[(x * 3.0), $MachinePrecision], If[LessEqual[y, -3.2e-251], z, If[LessEqual[y, -4.2e-275], N[(x * 3.0), $MachinePrecision], If[LessEqual[y, 4.7e-247], z, If[LessEqual[y, 1.1e-226], N[(x * 3.0), $MachinePrecision], If[LessEqual[y, 8.8e-167], z, If[LessEqual[y, 5.8e-99], N[(x * 3.0), $MachinePrecision], If[LessEqual[y, 1e-86], z, If[LessEqual[y, 1.05e-26], N[(x * 3.0), $MachinePrecision], If[LessEqual[y, 140000000.0], z, N[(y * 2.0), $MachinePrecision]]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+74}:\\
\;\;\;\;y \cdot 2\\
\mathbf{elif}\;y \leq -3 \cdot 10^{-171}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq -5.2 \cdot 10^{-205}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;y \leq -3.2 \cdot 10^{-251}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq -4.2 \cdot 10^{-275}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{-247}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-226}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{-167}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{-99}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;y \leq 10^{-86}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{-26}:\\
\;\;\;\;x \cdot 3\\
\mathbf{elif}\;y \leq 140000000:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;y \cdot 2\\
\end{array}
\end{array}
if y < -3.19999999999999995e74 or 1.4e8 < y Initial program 99.9%
associate-+l+99.9%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
+-commutative100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 64.4%
if -3.19999999999999995e74 < y < -3e-171 or -5.1999999999999997e-205 < y < -3.19999999999999982e-251 or -4.19999999999999976e-275 < y < 4.6999999999999998e-247 or 1.1e-226 < y < 8.7999999999999999e-167 or 5.79999999999999971e-99 < y < 1.00000000000000008e-86 or 1.05000000000000004e-26 < y < 1.4e8Initial program 99.9%
associate-+l+99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 59.5%
if -3e-171 < y < -5.1999999999999997e-205 or -3.19999999999999982e-251 < y < -4.19999999999999976e-275 or 4.6999999999999998e-247 < y < 1.1e-226 or 8.7999999999999999e-167 < y < 5.79999999999999971e-99 or 1.00000000000000008e-86 < y < 1.05000000000000004e-26Initial program 99.8%
associate-+l+99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
+-commutative99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 65.7%
Final simplification62.7%
(FPCore (x y z)
:precision binary64
(if (or (<= y -2.95e+147)
(not (or (<= y 1.1e+21) (and (not (<= y 3.9e+89)) (<= y 5.6e+125)))))
(* y 2.0)
(- z (* x -3.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.95e+147) || !((y <= 1.1e+21) || (!(y <= 3.9e+89) && (y <= 5.6e+125)))) {
tmp = y * 2.0;
} else {
tmp = z - (x * -3.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) :: tmp
if ((y <= (-2.95d+147)) .or. (.not. (y <= 1.1d+21) .or. (.not. (y <= 3.9d+89)) .and. (y <= 5.6d+125))) then
tmp = y * 2.0d0
else
tmp = z - (x * (-3.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.95e+147) || !((y <= 1.1e+21) || (!(y <= 3.9e+89) && (y <= 5.6e+125)))) {
tmp = y * 2.0;
} else {
tmp = z - (x * -3.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.95e+147) or not ((y <= 1.1e+21) or (not (y <= 3.9e+89) and (y <= 5.6e+125))): tmp = y * 2.0 else: tmp = z - (x * -3.0) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.95e+147) || !((y <= 1.1e+21) || (!(y <= 3.9e+89) && (y <= 5.6e+125)))) tmp = Float64(y * 2.0); else tmp = Float64(z - Float64(x * -3.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.95e+147) || ~(((y <= 1.1e+21) || (~((y <= 3.9e+89)) && (y <= 5.6e+125))))) tmp = y * 2.0; else tmp = z - (x * -3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.95e+147], N[Not[Or[LessEqual[y, 1.1e+21], And[N[Not[LessEqual[y, 3.9e+89]], $MachinePrecision], LessEqual[y, 5.6e+125]]]], $MachinePrecision]], N[(y * 2.0), $MachinePrecision], N[(z - N[(x * -3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.95 \cdot 10^{+147} \lor \neg \left(y \leq 1.1 \cdot 10^{+21} \lor \neg \left(y \leq 3.9 \cdot 10^{+89}\right) \land y \leq 5.6 \cdot 10^{+125}\right):\\
\;\;\;\;y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;z - x \cdot -3\\
\end{array}
\end{array}
if y < -2.9500000000000001e147 or 1.1e21 < y < 3.90000000000000011e89 or 5.6000000000000002e125 < y Initial program 99.9%
associate-+l+99.9%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
+-commutative100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 73.0%
if -2.9500000000000001e147 < y < 1.1e21 or 3.90000000000000011e89 < y < 5.6000000000000002e125Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
unsub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
distribute-neg-in99.9%
distribute-neg-out99.9%
neg-mul-199.9%
count-299.9%
distribute-lft-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-rgt-out99.9%
distribute-neg-out99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 83.4%
Final simplification80.3%
(FPCore (x y z)
:precision binary64
(if (or (<= y -2.3e+74)
(not
(or (<= y 1.22e+14) (and (not (<= y 1.22e+86)) (<= y 2.25e+113)))))
(* y 2.0)
z))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.3e+74) || !((y <= 1.22e+14) || (!(y <= 1.22e+86) && (y <= 2.25e+113)))) {
tmp = y * 2.0;
} else {
tmp = 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 <= (-2.3d+74)) .or. (.not. (y <= 1.22d+14) .or. (.not. (y <= 1.22d+86)) .and. (y <= 2.25d+113))) then
tmp = y * 2.0d0
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.3e+74) || !((y <= 1.22e+14) || (!(y <= 1.22e+86) && (y <= 2.25e+113)))) {
tmp = y * 2.0;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.3e+74) or not ((y <= 1.22e+14) or (not (y <= 1.22e+86) and (y <= 2.25e+113))): tmp = y * 2.0 else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.3e+74) || !((y <= 1.22e+14) || (!(y <= 1.22e+86) && (y <= 2.25e+113)))) tmp = Float64(y * 2.0); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.3e+74) || ~(((y <= 1.22e+14) || (~((y <= 1.22e+86)) && (y <= 2.25e+113))))) tmp = y * 2.0; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.3e+74], N[Not[Or[LessEqual[y, 1.22e+14], And[N[Not[LessEqual[y, 1.22e+86]], $MachinePrecision], LessEqual[y, 2.25e+113]]]], $MachinePrecision]], N[(y * 2.0), $MachinePrecision], z]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{+74} \lor \neg \left(y \leq 1.22 \cdot 10^{+14} \lor \neg \left(y \leq 1.22 \cdot 10^{+86}\right) \land y \leq 2.25 \cdot 10^{+113}\right):\\
\;\;\;\;y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if y < -2.2999999999999999e74 or 1.22e14 < y < 1.21999999999999996e86 or 2.25e113 < y Initial program 99.9%
associate-+l+99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around inf 66.3%
if -2.2999999999999999e74 < y < 1.22e14 or 1.21999999999999996e86 < y < 2.25e113Initial program 99.9%
associate-+l+99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 47.8%
Final simplification54.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- z (* x -3.0))))
(if (<= x -3.5e+85)
t_0
(if (<= x 7e+97)
(- z (* y -2.0))
(if (<= x 1.35e+175) (+ x (* 2.0 (+ x y))) t_0)))))
double code(double x, double y, double z) {
double t_0 = z - (x * -3.0);
double tmp;
if (x <= -3.5e+85) {
tmp = t_0;
} else if (x <= 7e+97) {
tmp = z - (y * -2.0);
} else if (x <= 1.35e+175) {
tmp = x + (2.0 * (x + y));
} 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) :: tmp
t_0 = z - (x * (-3.0d0))
if (x <= (-3.5d+85)) then
tmp = t_0
else if (x <= 7d+97) then
tmp = z - (y * (-2.0d0))
else if (x <= 1.35d+175) then
tmp = x + (2.0d0 * (x + y))
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 * -3.0);
double tmp;
if (x <= -3.5e+85) {
tmp = t_0;
} else if (x <= 7e+97) {
tmp = z - (y * -2.0);
} else if (x <= 1.35e+175) {
tmp = x + (2.0 * (x + y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z - (x * -3.0) tmp = 0 if x <= -3.5e+85: tmp = t_0 elif x <= 7e+97: tmp = z - (y * -2.0) elif x <= 1.35e+175: tmp = x + (2.0 * (x + y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z - Float64(x * -3.0)) tmp = 0.0 if (x <= -3.5e+85) tmp = t_0; elseif (x <= 7e+97) tmp = Float64(z - Float64(y * -2.0)); elseif (x <= 1.35e+175) tmp = Float64(x + Float64(2.0 * Float64(x + y))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z - (x * -3.0); tmp = 0.0; if (x <= -3.5e+85) tmp = t_0; elseif (x <= 7e+97) tmp = z - (y * -2.0); elseif (x <= 1.35e+175) tmp = x + (2.0 * (x + y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z - N[(x * -3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.5e+85], t$95$0, If[LessEqual[x, 7e+97], N[(z - N[(y * -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.35e+175], N[(x + N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z - x \cdot -3\\
\mathbf{if}\;x \leq -3.5 \cdot 10^{+85}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 7 \cdot 10^{+97}:\\
\;\;\;\;z - y \cdot -2\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+175}:\\
\;\;\;\;x + 2 \cdot \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -3.50000000000000005e85 or 1.35e175 < x Initial program 99.8%
+-commutative99.8%
associate-+l+99.8%
remove-double-neg99.8%
unsub-neg99.8%
+-commutative99.8%
+-commutative99.8%
associate-+l+99.8%
associate-+r+99.9%
associate-+r+99.9%
distribute-neg-in99.9%
distribute-neg-out99.9%
neg-mul-199.9%
count-299.9%
distribute-lft-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-rgt-out99.9%
distribute-neg-out99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 89.4%
if -3.50000000000000005e85 < x < 7.0000000000000001e97Initial program 99.9%
associate-+l+99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in x around 0 88.0%
metadata-eval88.0%
cancel-sign-sub-inv88.0%
*-commutative88.0%
Simplified88.0%
if 7.0000000000000001e97 < x < 1.35e175Initial program 99.9%
associate-+l+99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 81.2%
Final simplification88.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.52e+85) (not (<= x 2.75e-145))) (- z (* x -3.0)) (- z (* y -2.0))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.52e+85) || !(x <= 2.75e-145)) {
tmp = z - (x * -3.0);
} else {
tmp = z - (y * -2.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) :: tmp
if ((x <= (-1.52d+85)) .or. (.not. (x <= 2.75d-145))) then
tmp = z - (x * (-3.0d0))
else
tmp = z - (y * (-2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.52e+85) || !(x <= 2.75e-145)) {
tmp = z - (x * -3.0);
} else {
tmp = z - (y * -2.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.52e+85) or not (x <= 2.75e-145): tmp = z - (x * -3.0) else: tmp = z - (y * -2.0) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.52e+85) || !(x <= 2.75e-145)) tmp = Float64(z - Float64(x * -3.0)); else tmp = Float64(z - Float64(y * -2.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.52e+85) || ~((x <= 2.75e-145))) tmp = z - (x * -3.0); else tmp = z - (y * -2.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.52e+85], N[Not[LessEqual[x, 2.75e-145]], $MachinePrecision]], N[(z - N[(x * -3.0), $MachinePrecision]), $MachinePrecision], N[(z - N[(y * -2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.52 \cdot 10^{+85} \lor \neg \left(x \leq 2.75 \cdot 10^{-145}\right):\\
\;\;\;\;z - x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;z - y \cdot -2\\
\end{array}
\end{array}
if x < -1.52e85 or 2.75000000000000008e-145 < x Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
unsub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.8%
associate-+r+99.9%
associate-+r+99.9%
distribute-neg-in99.9%
distribute-neg-out99.9%
neg-mul-199.9%
count-299.9%
distribute-lft-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-rgt-out99.9%
distribute-neg-out99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 78.8%
if -1.52e85 < x < 2.75000000000000008e-145Initial program 99.9%
associate-+l+99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in x around 0 92.8%
metadata-eval92.8%
cancel-sign-sub-inv92.8%
*-commutative92.8%
Simplified92.8%
Final simplification86.1%
(FPCore (x y z) :precision binary64 (- (+ z (* x 3.0)) (* y -2.0)))
double code(double x, double y, double z) {
return (z + (x * 3.0)) - (y * -2.0);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (z + (x * 3.0d0)) - (y * (-2.0d0))
end function
public static double code(double x, double y, double z) {
return (z + (x * 3.0)) - (y * -2.0);
}
def code(x, y, z): return (z + (x * 3.0)) - (y * -2.0)
function code(x, y, z) return Float64(Float64(z + Float64(x * 3.0)) - Float64(y * -2.0)) end
function tmp = code(x, y, z) tmp = (z + (x * 3.0)) - (y * -2.0); end
code[x_, y_, z_] := N[(N[(z + N[(x * 3.0), $MachinePrecision]), $MachinePrecision] - N[(y * -2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(z + x \cdot 3\right) - y \cdot -2
\end{array}
Initial program 99.9%
+-commutative99.9%
associate-+l+99.9%
remove-double-neg99.9%
unsub-neg99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
associate-+r+99.9%
associate-+r+99.9%
distribute-neg-in99.9%
distribute-neg-out99.9%
neg-mul-199.9%
count-299.9%
distribute-lft-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-rgt-out99.9%
distribute-neg-out99.9%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around 0 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (+ (* 2.0 (+ x y)) (+ z x)))
double code(double x, double y, double z) {
return (2.0 * (x + y)) + (z + x);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (2.0d0 * (x + y)) + (z + x)
end function
public static double code(double x, double y, double z) {
return (2.0 * (x + y)) + (z + x);
}
def code(x, y, z): return (2.0 * (x + y)) + (z + x)
function code(x, y, z) return Float64(Float64(2.0 * Float64(x + y)) + Float64(z + x)) end
function tmp = code(x, y, z) tmp = (2.0 * (x + y)) + (z + x); end
code[x_, y_, z_] := N[(N[(2.0 * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(z + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(x + y\right) + \left(z + x\right)
\end{array}
Initial program 99.9%
associate-+l+99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 z)
double code(double x, double y, double z) {
return z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z
end function
public static double code(double x, double y, double z) {
return z;
}
def code(x, y, z): return z
function code(x, y, z) return z end
function tmp = code(x, y, z) tmp = z; end
code[x_, y_, z_] := z
\begin{array}{l}
\\
z
\end{array}
Initial program 99.9%
associate-+l+99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 36.6%
herbie shell --seed 2024105
(FPCore (x y z)
:name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendInside from plot-0.2.3.4"
:precision binary64
(+ (+ (+ (+ (+ x y) y) x) z) x))