
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (fma (- y z) (- t x) x))
double code(double x, double y, double z, double t) {
return fma((y - z), (t - x), x);
}
function code(x, y, z, t) return fma(Float64(y - z), Float64(t - x), x) end
code[x_, y_, z_, t_] := N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - z, t - x, x\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= z -1.2e+262)
t_1
(if (<= z -2.25e+48)
(* z x)
(if (<= z -1.15e-125)
t_1
(if (<= z 5e-157) x (if (<= z 3.1e+87) (* y (- x)) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -1.2e+262) {
tmp = t_1;
} else if (z <= -2.25e+48) {
tmp = z * x;
} else if (z <= -1.15e-125) {
tmp = t_1;
} else if (z <= 5e-157) {
tmp = x;
} else if (z <= 3.1e+87) {
tmp = y * -x;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = z * -t
if (z <= (-1.2d+262)) then
tmp = t_1
else if (z <= (-2.25d+48)) then
tmp = z * x
else if (z <= (-1.15d-125)) then
tmp = t_1
else if (z <= 5d-157) then
tmp = x
else if (z <= 3.1d+87) then
tmp = y * -x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -1.2e+262) {
tmp = t_1;
} else if (z <= -2.25e+48) {
tmp = z * x;
} else if (z <= -1.15e-125) {
tmp = t_1;
} else if (z <= 5e-157) {
tmp = x;
} else if (z <= 3.1e+87) {
tmp = y * -x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -1.2e+262: tmp = t_1 elif z <= -2.25e+48: tmp = z * x elif z <= -1.15e-125: tmp = t_1 elif z <= 5e-157: tmp = x elif z <= 3.1e+87: tmp = y * -x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -1.2e+262) tmp = t_1; elseif (z <= -2.25e+48) tmp = Float64(z * x); elseif (z <= -1.15e-125) tmp = t_1; elseif (z <= 5e-157) tmp = x; elseif (z <= 3.1e+87) tmp = Float64(y * Float64(-x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; tmp = 0.0; if (z <= -1.2e+262) tmp = t_1; elseif (z <= -2.25e+48) tmp = z * x; elseif (z <= -1.15e-125) tmp = t_1; elseif (z <= 5e-157) tmp = x; elseif (z <= 3.1e+87) tmp = y * -x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[z, -1.2e+262], t$95$1, If[LessEqual[z, -2.25e+48], N[(z * x), $MachinePrecision], If[LessEqual[z, -1.15e-125], t$95$1, If[LessEqual[z, 5e-157], x, If[LessEqual[z, 3.1e+87], N[(y * (-x)), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -1.2 \cdot 10^{+262}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.25 \cdot 10^{+48}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -1.15 \cdot 10^{-125}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-157}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{+87}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.19999999999999991e262 or -2.24999999999999998e48 < z < -1.15e-125 or 3.1e87 < z Initial program 99.9%
Taylor expanded in y around 0 76.9%
mul-1-neg76.9%
unsub-neg76.9%
Simplified76.9%
Taylor expanded in t around inf 51.5%
Taylor expanded in x around 0 47.6%
mul-1-neg47.6%
*-commutative47.6%
distribute-rgt-neg-in47.6%
Simplified47.6%
if -1.19999999999999991e262 < z < -2.24999999999999998e48Initial program 100.0%
Taylor expanded in x around inf 66.1%
mul-1-neg66.1%
unsub-neg66.1%
Simplified66.1%
Taylor expanded in z around inf 54.6%
if -1.15e-125 < z < 5.0000000000000002e-157Initial program 100.0%
Taylor expanded in y around inf 96.6%
*-commutative96.6%
Simplified96.6%
Taylor expanded in y around 0 42.6%
if 5.0000000000000002e-157 < z < 3.1e87Initial program 100.0%
Taylor expanded in x around inf 76.3%
mul-1-neg76.3%
unsub-neg76.3%
Simplified76.3%
Taylor expanded in y around inf 43.3%
mul-1-neg43.3%
Simplified43.3%
Final simplification46.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- x))))
(if (<= z -13500.0)
(* z x)
(if (<= z -2.45e-101)
t_1
(if (<= z 2.7e-159) x (if (<= z 6e+21) t_1 (* z x)))))))
double code(double x, double y, double z, double t) {
double t_1 = y * -x;
double tmp;
if (z <= -13500.0) {
tmp = z * x;
} else if (z <= -2.45e-101) {
tmp = t_1;
} else if (z <= 2.7e-159) {
tmp = x;
} else if (z <= 6e+21) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * -x
if (z <= (-13500.0d0)) then
tmp = z * x
else if (z <= (-2.45d-101)) then
tmp = t_1
else if (z <= 2.7d-159) then
tmp = x
else if (z <= 6d+21) then
tmp = t_1
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * -x;
double tmp;
if (z <= -13500.0) {
tmp = z * x;
} else if (z <= -2.45e-101) {
tmp = t_1;
} else if (z <= 2.7e-159) {
tmp = x;
} else if (z <= 6e+21) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * -x tmp = 0 if z <= -13500.0: tmp = z * x elif z <= -2.45e-101: tmp = t_1 elif z <= 2.7e-159: tmp = x elif z <= 6e+21: tmp = t_1 else: tmp = z * x return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(-x)) tmp = 0.0 if (z <= -13500.0) tmp = Float64(z * x); elseif (z <= -2.45e-101) tmp = t_1; elseif (z <= 2.7e-159) tmp = x; elseif (z <= 6e+21) tmp = t_1; else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * -x; tmp = 0.0; if (z <= -13500.0) tmp = z * x; elseif (z <= -2.45e-101) tmp = t_1; elseif (z <= 2.7e-159) tmp = x; elseif (z <= 6e+21) tmp = t_1; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-x)), $MachinePrecision]}, If[LessEqual[z, -13500.0], N[(z * x), $MachinePrecision], If[LessEqual[z, -2.45e-101], t$95$1, If[LessEqual[z, 2.7e-159], x, If[LessEqual[z, 6e+21], t$95$1, N[(z * x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(-x\right)\\
\mathbf{if}\;z \leq -13500:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -2.45 \cdot 10^{-101}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-159}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -13500 or 6e21 < z Initial program 100.0%
Taylor expanded in x around inf 53.7%
mul-1-neg53.7%
unsub-neg53.7%
Simplified53.7%
Taylor expanded in z around inf 46.0%
if -13500 < z < -2.45e-101 or 2.7e-159 < z < 6e21Initial program 100.0%
Taylor expanded in x around inf 72.1%
mul-1-neg72.1%
unsub-neg72.1%
Simplified72.1%
Taylor expanded in y around inf 46.2%
mul-1-neg46.2%
Simplified46.2%
if -2.45e-101 < z < 2.7e-159Initial program 100.0%
Taylor expanded in y around inf 94.5%
*-commutative94.5%
Simplified94.5%
Taylor expanded in y around 0 40.9%
Final simplification44.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))))
(if (<= z -6.4e+28)
t_1
(if (<= z 4.5e-173)
(+ x (* y t))
(if (<= z 3.5e+24) (* x (+ (- z y) 1.0)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -6.4e+28) {
tmp = t_1;
} else if (z <= 4.5e-173) {
tmp = x + (y * t);
} else if (z <= 3.5e+24) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = z * (x - t)
if (z <= (-6.4d+28)) then
tmp = t_1
else if (z <= 4.5d-173) then
tmp = x + (y * t)
else if (z <= 3.5d+24) then
tmp = x * ((z - y) + 1.0d0)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -6.4e+28) {
tmp = t_1;
} else if (z <= 4.5e-173) {
tmp = x + (y * t);
} else if (z <= 3.5e+24) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -6.4e+28: tmp = t_1 elif z <= 4.5e-173: tmp = x + (y * t) elif z <= 3.5e+24: tmp = x * ((z - y) + 1.0) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -6.4e+28) tmp = t_1; elseif (z <= 4.5e-173) tmp = Float64(x + Float64(y * t)); elseif (z <= 3.5e+24) tmp = Float64(x * Float64(Float64(z - y) + 1.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); tmp = 0.0; if (z <= -6.4e+28) tmp = t_1; elseif (z <= 4.5e-173) tmp = x + (y * t); elseif (z <= 3.5e+24) tmp = x * ((z - y) + 1.0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.4e+28], t$95$1, If[LessEqual[z, 4.5e-173], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e+24], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -6.4 \cdot 10^{+28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-173}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+24}:\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.4000000000000001e28 or 3.5000000000000002e24 < z Initial program 100.0%
Taylor expanded in y around 0 84.1%
mul-1-neg84.1%
unsub-neg84.1%
Simplified84.1%
Taylor expanded in x around 0 76.2%
Taylor expanded in z around inf 84.1%
if -6.4000000000000001e28 < z < 4.50000000000000018e-173Initial program 100.0%
Taylor expanded in t around inf 78.8%
Taylor expanded in y around inf 70.1%
if 4.50000000000000018e-173 < z < 3.5000000000000002e24Initial program 99.9%
Taylor expanded in x around inf 79.4%
mul-1-neg79.4%
unsub-neg79.4%
Simplified79.4%
Final simplification78.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))))
(if (<= z -6.4e+28)
t_1
(if (<= z 2.7e-173)
(+ x (* y t))
(if (<= z 3.8e+18) (* x (- 1.0 y)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -6.4e+28) {
tmp = t_1;
} else if (z <= 2.7e-173) {
tmp = x + (y * t);
} else if (z <= 3.8e+18) {
tmp = x * (1.0 - y);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = z * (x - t)
if (z <= (-6.4d+28)) then
tmp = t_1
else if (z <= 2.7d-173) then
tmp = x + (y * t)
else if (z <= 3.8d+18) then
tmp = x * (1.0d0 - y)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -6.4e+28) {
tmp = t_1;
} else if (z <= 2.7e-173) {
tmp = x + (y * t);
} else if (z <= 3.8e+18) {
tmp = x * (1.0 - y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -6.4e+28: tmp = t_1 elif z <= 2.7e-173: tmp = x + (y * t) elif z <= 3.8e+18: tmp = x * (1.0 - y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -6.4e+28) tmp = t_1; elseif (z <= 2.7e-173) tmp = Float64(x + Float64(y * t)); elseif (z <= 3.8e+18) tmp = Float64(x * Float64(1.0 - y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); tmp = 0.0; if (z <= -6.4e+28) tmp = t_1; elseif (z <= 2.7e-173) tmp = x + (y * t); elseif (z <= 3.8e+18) tmp = x * (1.0 - y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.4e+28], t$95$1, If[LessEqual[z, 2.7e-173], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.8e+18], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -6.4 \cdot 10^{+28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-173}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+18}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.4000000000000001e28 or 3.8e18 < z Initial program 100.0%
Taylor expanded in y around 0 84.1%
mul-1-neg84.1%
unsub-neg84.1%
Simplified84.1%
Taylor expanded in x around 0 76.2%
Taylor expanded in z around inf 84.1%
if -6.4000000000000001e28 < z < 2.7e-173Initial program 100.0%
Taylor expanded in t around inf 78.8%
Taylor expanded in y around inf 70.1%
if 2.7e-173 < z < 3.8e18Initial program 99.9%
Taylor expanded in x around inf 79.4%
mul-1-neg79.4%
unsub-neg79.4%
Simplified79.4%
Taylor expanded in z around 0 76.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))))
(if (<= z -7.2e+28)
t_1
(if (<= z -9.5e-166)
(* y (- t x))
(if (<= z 3.8e+18) (* x (- 1.0 y)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -7.2e+28) {
tmp = t_1;
} else if (z <= -9.5e-166) {
tmp = y * (t - x);
} else if (z <= 3.8e+18) {
tmp = x * (1.0 - y);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = z * (x - t)
if (z <= (-7.2d+28)) then
tmp = t_1
else if (z <= (-9.5d-166)) then
tmp = y * (t - x)
else if (z <= 3.8d+18) then
tmp = x * (1.0d0 - y)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -7.2e+28) {
tmp = t_1;
} else if (z <= -9.5e-166) {
tmp = y * (t - x);
} else if (z <= 3.8e+18) {
tmp = x * (1.0 - y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -7.2e+28: tmp = t_1 elif z <= -9.5e-166: tmp = y * (t - x) elif z <= 3.8e+18: tmp = x * (1.0 - y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -7.2e+28) tmp = t_1; elseif (z <= -9.5e-166) tmp = Float64(y * Float64(t - x)); elseif (z <= 3.8e+18) tmp = Float64(x * Float64(1.0 - y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); tmp = 0.0; if (z <= -7.2e+28) tmp = t_1; elseif (z <= -9.5e-166) tmp = y * (t - x); elseif (z <= 3.8e+18) tmp = x * (1.0 - y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.2e+28], t$95$1, If[LessEqual[z, -9.5e-166], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.8e+18], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -7.2 \cdot 10^{+28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -9.5 \cdot 10^{-166}:\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+18}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.1999999999999999e28 or 3.8e18 < z Initial program 100.0%
Taylor expanded in y around 0 84.1%
mul-1-neg84.1%
unsub-neg84.1%
Simplified84.1%
Taylor expanded in x around 0 76.2%
Taylor expanded in z around inf 84.1%
if -7.1999999999999999e28 < z < -9.50000000000000046e-166Initial program 99.9%
sub-neg99.9%
distribute-lft-in99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 94.2%
associate-*r*94.2%
mul-1-neg94.2%
Simplified94.2%
associate-+r+94.2%
distribute-lft-neg-out94.2%
unsub-neg94.2%
*-commutative94.2%
Applied egg-rr94.2%
Taylor expanded in y around inf 58.9%
if -9.50000000000000046e-166 < z < 3.8e18Initial program 100.0%
Taylor expanded in x around inf 68.0%
mul-1-neg68.0%
unsub-neg68.0%
Simplified68.0%
Taylor expanded in z around 0 67.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= z -9.4e+262)
t_1
(if (<= z -1.72e-6)
(* x (+ z 1.0))
(if (<= z 2.2e+87) (* x (- 1.0 y)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -9.4e+262) {
tmp = t_1;
} else if (z <= -1.72e-6) {
tmp = x * (z + 1.0);
} else if (z <= 2.2e+87) {
tmp = x * (1.0 - y);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = z * -t
if (z <= (-9.4d+262)) then
tmp = t_1
else if (z <= (-1.72d-6)) then
tmp = x * (z + 1.0d0)
else if (z <= 2.2d+87) then
tmp = x * (1.0d0 - y)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -9.4e+262) {
tmp = t_1;
} else if (z <= -1.72e-6) {
tmp = x * (z + 1.0);
} else if (z <= 2.2e+87) {
tmp = x * (1.0 - y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -9.4e+262: tmp = t_1 elif z <= -1.72e-6: tmp = x * (z + 1.0) elif z <= 2.2e+87: tmp = x * (1.0 - y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -9.4e+262) tmp = t_1; elseif (z <= -1.72e-6) tmp = Float64(x * Float64(z + 1.0)); elseif (z <= 2.2e+87) tmp = Float64(x * Float64(1.0 - y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; tmp = 0.0; if (z <= -9.4e+262) tmp = t_1; elseif (z <= -1.72e-6) tmp = x * (z + 1.0); elseif (z <= 2.2e+87) tmp = x * (1.0 - y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[z, -9.4e+262], t$95$1, If[LessEqual[z, -1.72e-6], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e+87], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -9.4 \cdot 10^{+262}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.72 \cdot 10^{-6}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+87}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.40000000000000029e262 or 2.2000000000000001e87 < z Initial program 100.0%
Taylor expanded in y around 0 89.3%
mul-1-neg89.3%
unsub-neg89.3%
Simplified89.3%
Taylor expanded in t around inf 55.0%
Taylor expanded in x around 0 54.6%
mul-1-neg54.6%
*-commutative54.6%
distribute-rgt-neg-in54.6%
Simplified54.6%
if -9.40000000000000029e262 < z < -1.72e-6Initial program 99.9%
Taylor expanded in x around inf 60.7%
mul-1-neg60.7%
unsub-neg60.7%
Simplified60.7%
Taylor expanded in y around 0 50.7%
+-commutative50.7%
Simplified50.7%
if -1.72e-6 < z < 2.2000000000000001e87Initial program 100.0%
Taylor expanded in x around inf 64.3%
mul-1-neg64.3%
unsub-neg64.3%
Simplified64.3%
Taylor expanded in z around 0 60.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.8e+28) (not (<= z 1.56e+22))) (* z (- x t)) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.8e+28) || !(z <= 1.56e+22)) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-6.8d+28)) .or. (.not. (z <= 1.56d+22))) then
tmp = z * (x - t)
else
tmp = x + (y * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.8e+28) || !(z <= 1.56e+22)) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.8e+28) or not (z <= 1.56e+22): tmp = z * (x - t) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.8e+28) || !(z <= 1.56e+22)) tmp = Float64(z * Float64(x - t)); else tmp = Float64(x + Float64(y * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6.8e+28) || ~((z <= 1.56e+22))) tmp = z * (x - t); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.8e+28], N[Not[LessEqual[z, 1.56e+22]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{+28} \lor \neg \left(z \leq 1.56 \cdot 10^{+22}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -6.8e28 or 1.56e22 < z Initial program 100.0%
Taylor expanded in y around 0 84.1%
mul-1-neg84.1%
unsub-neg84.1%
Simplified84.1%
Taylor expanded in x around 0 76.2%
Taylor expanded in z around inf 84.1%
if -6.8e28 < z < 1.56e22Initial program 100.0%
Taylor expanded in y around inf 89.3%
*-commutative89.3%
Simplified89.3%
Final simplification86.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- x t)))) (if (<= z -0.175) (+ x t_1) (if (<= z 3.9e+20) (+ x (* y (- t x))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -0.175) {
tmp = x + t_1;
} else if (z <= 3.9e+20) {
tmp = x + (y * (t - x));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = z * (x - t)
if (z <= (-0.175d0)) then
tmp = x + t_1
else if (z <= 3.9d+20) then
tmp = x + (y * (t - x))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -0.175) {
tmp = x + t_1;
} else if (z <= 3.9e+20) {
tmp = x + (y * (t - x));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -0.175: tmp = x + t_1 elif z <= 3.9e+20: tmp = x + (y * (t - x)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -0.175) tmp = Float64(x + t_1); elseif (z <= 3.9e+20) tmp = Float64(x + Float64(y * Float64(t - x))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); tmp = 0.0; if (z <= -0.175) tmp = x + t_1; elseif (z <= 3.9e+20) tmp = x + (y * (t - x)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.175], N[(x + t$95$1), $MachinePrecision], If[LessEqual[z, 3.9e+20], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -0.175:\\
\;\;\;\;x + t\_1\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{+20}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.17499999999999999Initial program 100.0%
Taylor expanded in y around 0 80.7%
mul-1-neg80.7%
unsub-neg80.7%
Simplified80.7%
if -0.17499999999999999 < z < 3.9e20Initial program 100.0%
Taylor expanded in y around inf 91.1%
*-commutative91.1%
Simplified91.1%
if 3.9e20 < z Initial program 100.0%
Taylor expanded in y around 0 85.9%
mul-1-neg85.9%
unsub-neg85.9%
Simplified85.9%
Taylor expanded in x around 0 74.8%
Taylor expanded in z around inf 85.9%
Final simplification87.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -150000.0) (not (<= y 5.4e+63))) (* y (- t x)) (* x (+ z 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -150000.0) || !(y <= 5.4e+63)) {
tmp = y * (t - x);
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-150000.0d0)) .or. (.not. (y <= 5.4d+63))) then
tmp = y * (t - x)
else
tmp = x * (z + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -150000.0) || !(y <= 5.4e+63)) {
tmp = y * (t - x);
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -150000.0) or not (y <= 5.4e+63): tmp = y * (t - x) else: tmp = x * (z + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -150000.0) || !(y <= 5.4e+63)) tmp = Float64(y * Float64(t - x)); else tmp = Float64(x * Float64(z + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -150000.0) || ~((y <= 5.4e+63))) tmp = y * (t - x); else tmp = x * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -150000.0], N[Not[LessEqual[y, 5.4e+63]], $MachinePrecision]], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -150000 \lor \neg \left(y \leq 5.4 \cdot 10^{+63}\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if y < -1.5e5 or 5.40000000000000035e63 < y Initial program 100.0%
sub-neg100.0%
distribute-lft-in95.5%
Applied egg-rr95.5%
Taylor expanded in y around inf 88.3%
associate-*r*88.3%
mul-1-neg88.3%
Simplified88.3%
associate-+r+88.3%
distribute-lft-neg-out88.3%
unsub-neg88.3%
*-commutative88.3%
Applied egg-rr88.3%
Taylor expanded in y around inf 79.8%
if -1.5e5 < y < 5.40000000000000035e63Initial program 100.0%
Taylor expanded in x around inf 62.7%
mul-1-neg62.7%
unsub-neg62.7%
Simplified62.7%
Taylor expanded in y around 0 59.4%
+-commutative59.4%
Simplified59.4%
Final simplification68.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.5e-50) (not (<= t 1.4e+54))) (* z (- t)) (* x (+ z 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.5e-50) || !(t <= 1.4e+54)) {
tmp = z * -t;
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-2.5d-50)) .or. (.not. (t <= 1.4d+54))) then
tmp = z * -t
else
tmp = x * (z + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.5e-50) || !(t <= 1.4e+54)) {
tmp = z * -t;
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.5e-50) or not (t <= 1.4e+54): tmp = z * -t else: tmp = x * (z + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.5e-50) || !(t <= 1.4e+54)) tmp = Float64(z * Float64(-t)); else tmp = Float64(x * Float64(z + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.5e-50) || ~((t <= 1.4e+54))) tmp = z * -t; else tmp = x * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.5e-50], N[Not[LessEqual[t, 1.4e+54]], $MachinePrecision]], N[(z * (-t)), $MachinePrecision], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{-50} \lor \neg \left(t \leq 1.4 \cdot 10^{+54}\right):\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if t < -2.49999999999999984e-50 or 1.40000000000000008e54 < t Initial program 100.0%
Taylor expanded in y around 0 57.9%
mul-1-neg57.9%
unsub-neg57.9%
Simplified57.9%
Taylor expanded in t around inf 49.9%
Taylor expanded in x around 0 44.4%
mul-1-neg44.4%
*-commutative44.4%
distribute-rgt-neg-in44.4%
Simplified44.4%
if -2.49999999999999984e-50 < t < 1.40000000000000008e54Initial program 100.0%
Taylor expanded in x around inf 83.5%
mul-1-neg83.5%
unsub-neg83.5%
Simplified83.5%
Taylor expanded in y around 0 62.2%
+-commutative62.2%
Simplified62.2%
Final simplification53.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.02) (not (<= z 1.6e-15))) (* z x) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.02) || !(z <= 1.6e-15)) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.02d0)) .or. (.not. (z <= 1.6d-15))) then
tmp = z * x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.02) || !(z <= 1.6e-15)) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.02) or not (z <= 1.6e-15): tmp = z * x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.02) || !(z <= 1.6e-15)) tmp = Float64(z * x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.02) || ~((z <= 1.6e-15))) tmp = z * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.02], N[Not[LessEqual[z, 1.6e-15]], $MachinePrecision]], N[(z * x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \lor \neg \left(z \leq 1.6 \cdot 10^{-15}\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.02 or 1.6e-15 < z Initial program 99.9%
Taylor expanded in x around inf 54.3%
mul-1-neg54.3%
unsub-neg54.3%
Simplified54.3%
Taylor expanded in z around inf 44.3%
if -1.02 < z < 1.6e-15Initial program 100.0%
Taylor expanded in y around inf 90.8%
*-commutative90.8%
Simplified90.8%
Taylor expanded in y around 0 37.0%
Final simplification40.9%
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Initial program 100.0%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in y around inf 58.2%
*-commutative58.2%
Simplified58.2%
Taylor expanded in y around 0 18.8%
(FPCore (x y z t) :precision binary64 (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
double code(double x, double y, double z, double t) {
return x + ((t * (y - z)) + (-x * (y - z)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((t * (y - z)) + (-x * (y - z)))
end function
public static double code(double x, double y, double z, double t) {
return x + ((t * (y - z)) + (-x * (y - z)));
}
def code(x, y, z, t): return x + ((t * (y - z)) + (-x * (y - z)))
function code(x, y, z, t) return Float64(x + Float64(Float64(t * Float64(y - z)) + Float64(Float64(-x) * Float64(y - z)))) end
function tmp = code(x, y, z, t) tmp = x + ((t * (y - z)) + (-x * (y - z))); end
code[x_, y_, z_, t_] := N[(x + N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] + N[((-x) * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t \cdot \left(y - z\right) + \left(-x\right) \cdot \left(y - z\right)\right)
\end{array}
herbie shell --seed 2024130
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:alt
(! :herbie-platform default (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
(+ x (* (- y z) (- t x))))