
(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 (* y (- x))) (t_2 (* z (- t))))
(if (<= y -1.2e+53)
t_1
(if (<= y -7e-79)
t_2
(if (<= y -3.6e-219) x (if (<= y 1.85e+122) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * -x;
double t_2 = z * -t;
double tmp;
if (y <= -1.2e+53) {
tmp = t_1;
} else if (y <= -7e-79) {
tmp = t_2;
} else if (y <= -3.6e-219) {
tmp = x;
} else if (y <= 1.85e+122) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = y * -x
t_2 = z * -t
if (y <= (-1.2d+53)) then
tmp = t_1
else if (y <= (-7d-79)) then
tmp = t_2
else if (y <= (-3.6d-219)) then
tmp = x
else if (y <= 1.85d+122) 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) {
double t_1 = y * -x;
double t_2 = z * -t;
double tmp;
if (y <= -1.2e+53) {
tmp = t_1;
} else if (y <= -7e-79) {
tmp = t_2;
} else if (y <= -3.6e-219) {
tmp = x;
} else if (y <= 1.85e+122) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * -x t_2 = z * -t tmp = 0 if y <= -1.2e+53: tmp = t_1 elif y <= -7e-79: tmp = t_2 elif y <= -3.6e-219: tmp = x elif y <= 1.85e+122: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(-x)) t_2 = Float64(z * Float64(-t)) tmp = 0.0 if (y <= -1.2e+53) tmp = t_1; elseif (y <= -7e-79) tmp = t_2; elseif (y <= -3.6e-219) tmp = x; elseif (y <= 1.85e+122) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * -x; t_2 = z * -t; tmp = 0.0; if (y <= -1.2e+53) tmp = t_1; elseif (y <= -7e-79) tmp = t_2; elseif (y <= -3.6e-219) tmp = x; elseif (y <= 1.85e+122) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-x)), $MachinePrecision]}, Block[{t$95$2 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[y, -1.2e+53], t$95$1, If[LessEqual[y, -7e-79], t$95$2, If[LessEqual[y, -3.6e-219], x, If[LessEqual[y, 1.85e+122], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(-x\right)\\
t_2 := z \cdot \left(-t\right)\\
\mathbf{if}\;y \leq -1.2 \cdot 10^{+53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -7 \cdot 10^{-79}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -3.6 \cdot 10^{-219}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{+122}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.2e53 or 1.8499999999999998e122 < y Initial program 100.0%
Taylor expanded in x around inf 56.8%
mul-1-neg56.8%
unsub-neg56.8%
Simplified56.8%
Taylor expanded in y around inf 50.2%
mul-1-neg50.2%
Simplified50.2%
if -1.2e53 < y < -7.00000000000000059e-79 or -3.59999999999999974e-219 < y < 1.8499999999999998e122Initial program 99.9%
Taylor expanded in y around 0 77.5%
mul-1-neg77.5%
unsub-neg77.5%
Simplified77.5%
Taylor expanded in x around 0 75.4%
Taylor expanded in x around 0 41.4%
mul-1-neg41.4%
*-commutative41.4%
distribute-rgt-neg-in41.4%
Simplified41.4%
if -7.00000000000000059e-79 < y < -3.59999999999999974e-219Initial program 100.0%
Taylor expanded in y around inf 54.2%
*-commutative54.2%
Simplified54.2%
Taylor expanded in y around 0 52.5%
Final simplification45.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))))
(if (<= z -7e+22)
t_1
(if (<= z -3.2e-268)
(+ x (* y t))
(if (<= z 1860000000.0) (* 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 <= -7e+22) {
tmp = t_1;
} else if (z <= -3.2e-268) {
tmp = x + (y * t);
} else if (z <= 1860000000.0) {
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 <= (-7d+22)) then
tmp = t_1
else if (z <= (-3.2d-268)) then
tmp = x + (y * t)
else if (z <= 1860000000.0d0) 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 <= -7e+22) {
tmp = t_1;
} else if (z <= -3.2e-268) {
tmp = x + (y * t);
} else if (z <= 1860000000.0) {
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 <= -7e+22: tmp = t_1 elif z <= -3.2e-268: tmp = x + (y * t) elif z <= 1860000000.0: 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 <= -7e+22) tmp = t_1; elseif (z <= -3.2e-268) tmp = Float64(x + Float64(y * t)); elseif (z <= 1860000000.0) 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 <= -7e+22) tmp = t_1; elseif (z <= -3.2e-268) tmp = x + (y * t); elseif (z <= 1860000000.0) 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, -7e+22], t$95$1, If[LessEqual[z, -3.2e-268], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1860000000.0], 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 -7 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{-268}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;z \leq 1860000000:\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7e22 or 1.86e9 < z Initial program 100.0%
Taylor expanded in y around 0 83.5%
mul-1-neg83.5%
unsub-neg83.5%
Simplified83.5%
Taylor expanded in x around 0 79.5%
Taylor expanded in z around inf 83.5%
if -7e22 < z < -3.1999999999999999e-268Initial program 100.0%
Taylor expanded in t around inf 73.1%
Taylor expanded in y around inf 65.8%
if -3.1999999999999999e-268 < z < 1.86e9Initial program 100.0%
Taylor expanded in x around inf 69.3%
mul-1-neg69.3%
unsub-neg69.3%
Simplified69.3%
Final simplification75.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))))
(if (<= z -7.5e+22)
t_1
(if (<= z -2.25e-268)
(+ x (* y t))
(if (<= z 0.016) (* 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.5e+22) {
tmp = t_1;
} else if (z <= -2.25e-268) {
tmp = x + (y * t);
} else if (z <= 0.016) {
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.5d+22)) then
tmp = t_1
else if (z <= (-2.25d-268)) then
tmp = x + (y * t)
else if (z <= 0.016d0) 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.5e+22) {
tmp = t_1;
} else if (z <= -2.25e-268) {
tmp = x + (y * t);
} else if (z <= 0.016) {
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.5e+22: tmp = t_1 elif z <= -2.25e-268: tmp = x + (y * t) elif z <= 0.016: 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.5e+22) tmp = t_1; elseif (z <= -2.25e-268) tmp = Float64(x + Float64(y * t)); elseif (z <= 0.016) 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.5e+22) tmp = t_1; elseif (z <= -2.25e-268) tmp = x + (y * t); elseif (z <= 0.016) 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.5e+22], t$95$1, If[LessEqual[z, -2.25e-268], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.016], 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.5 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.25 \cdot 10^{-268}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;z \leq 0.016:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.5000000000000002e22 or 0.016 < z Initial program 100.0%
Taylor expanded in y around 0 83.2%
mul-1-neg83.2%
unsub-neg83.2%
Simplified83.2%
Taylor expanded in x around 0 79.4%
Taylor expanded in z around inf 82.4%
if -7.5000000000000002e22 < z < -2.2500000000000001e-268Initial program 100.0%
Taylor expanded in t around inf 73.1%
Taylor expanded in y around inf 65.8%
if -2.2500000000000001e-268 < z < 0.016Initial program 100.0%
Taylor expanded in x around inf 70.3%
mul-1-neg70.3%
unsub-neg70.3%
Simplified70.3%
Taylor expanded in z around 0 70.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.6e+40) (not (<= z 21500.0))) (* z (- x t)) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.6e+40) || !(z <= 21500.0)) {
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.6d+40)) .or. (.not. (z <= 21500.0d0))) 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.6e+40) || !(z <= 21500.0)) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.6e+40) or not (z <= 21500.0): tmp = z * (x - t) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.6e+40) || !(z <= 21500.0)) 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.6e+40) || ~((z <= 21500.0))) 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.6e+40], N[Not[LessEqual[z, 21500.0]], $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.6 \cdot 10^{+40} \lor \neg \left(z \leq 21500\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -6.5999999999999997e40 or 21500 < z Initial program 100.0%
Taylor expanded in y around 0 85.5%
mul-1-neg85.5%
unsub-neg85.5%
Simplified85.5%
Taylor expanded in x around 0 81.4%
Taylor expanded in z around inf 84.6%
if -6.5999999999999997e40 < z < 21500Initial program 100.0%
Taylor expanded in y around inf 90.5%
*-commutative90.5%
Simplified90.5%
Final simplification87.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- x t)))) (if (<= z -5e+41) t_1 (if (<= z 24000.0) (+ x (* y (- t x))) (+ x t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -5e+41) {
tmp = t_1;
} else if (z <= 24000.0) {
tmp = x + (y * (t - x));
} else {
tmp = x + 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 <= (-5d+41)) then
tmp = t_1
else if (z <= 24000.0d0) then
tmp = x + (y * (t - x))
else
tmp = x + 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 <= -5e+41) {
tmp = t_1;
} else if (z <= 24000.0) {
tmp = x + (y * (t - x));
} else {
tmp = x + t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -5e+41: tmp = t_1 elif z <= 24000.0: tmp = x + (y * (t - x)) else: tmp = x + t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -5e+41) tmp = t_1; elseif (z <= 24000.0) tmp = Float64(x + Float64(y * Float64(t - x))); else tmp = Float64(x + t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); tmp = 0.0; if (z <= -5e+41) tmp = t_1; elseif (z <= 24000.0) tmp = x + (y * (t - x)); else tmp = x + 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, -5e+41], t$95$1, If[LessEqual[z, 24000.0], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -5 \cdot 10^{+41}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 24000:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\_1\\
\end{array}
\end{array}
if z < -5.00000000000000022e41Initial program 100.0%
Taylor expanded in y around 0 91.4%
mul-1-neg91.4%
unsub-neg91.4%
Simplified91.4%
Taylor expanded in x around 0 87.1%
Taylor expanded in z around inf 91.4%
if -5.00000000000000022e41 < z < 24000Initial program 100.0%
Taylor expanded in y around inf 90.5%
*-commutative90.5%
Simplified90.5%
if 24000 < z Initial program 99.9%
Taylor expanded in y around 0 81.8%
mul-1-neg81.8%
unsub-neg81.8%
Simplified81.8%
Final simplification88.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7e+22) (not (<= z 1.5e-9))) (* z (- x t)) (* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7e+22) || !(z <= 1.5e-9)) {
tmp = z * (x - t);
} else {
tmp = x * (1.0 - y);
}
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 <= (-7d+22)) .or. (.not. (z <= 1.5d-9))) then
tmp = z * (x - t)
else
tmp = x * (1.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7e+22) || !(z <= 1.5e-9)) {
tmp = z * (x - t);
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7e+22) or not (z <= 1.5e-9): tmp = z * (x - t) else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7e+22) || !(z <= 1.5e-9)) tmp = Float64(z * Float64(x - t)); else tmp = Float64(x * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7e+22) || ~((z <= 1.5e-9))) tmp = z * (x - t); else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7e+22], N[Not[LessEqual[z, 1.5e-9]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+22} \lor \neg \left(z \leq 1.5 \cdot 10^{-9}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if z < -7e22 or 1.49999999999999999e-9 < z Initial program 100.0%
Taylor expanded in y around 0 83.2%
mul-1-neg83.2%
unsub-neg83.2%
Simplified83.2%
Taylor expanded in x around 0 79.4%
Taylor expanded in z around inf 82.4%
if -7e22 < z < 1.49999999999999999e-9Initial program 100.0%
Taylor expanded in x around inf 62.2%
mul-1-neg62.2%
unsub-neg62.2%
Simplified62.2%
Taylor expanded in z around 0 61.6%
Final simplification72.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.6e+40) (not (<= z 0.00125))) (* z (- t)) (* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.6e+40) || !(z <= 0.00125)) {
tmp = z * -t;
} else {
tmp = x * (1.0 - y);
}
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.6d+40)) .or. (.not. (z <= 0.00125d0))) then
tmp = z * -t
else
tmp = x * (1.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.6e+40) || !(z <= 0.00125)) {
tmp = z * -t;
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.6e+40) or not (z <= 0.00125): tmp = z * -t else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.6e+40) || !(z <= 0.00125)) tmp = Float64(z * Float64(-t)); else tmp = Float64(x * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6.6e+40) || ~((z <= 0.00125))) tmp = z * -t; else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.6e+40], N[Not[LessEqual[z, 0.00125]], $MachinePrecision]], N[(z * (-t)), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{+40} \lor \neg \left(z \leq 0.00125\right):\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if z < -6.5999999999999997e40 or 0.00125000000000000003 < z Initial program 100.0%
Taylor expanded in y around 0 85.0%
mul-1-neg85.0%
unsub-neg85.0%
Simplified85.0%
Taylor expanded in x around 0 81.0%
Taylor expanded in x around 0 52.0%
mul-1-neg52.0%
*-commutative52.0%
distribute-rgt-neg-in52.0%
Simplified52.0%
if -6.5999999999999997e40 < z < 0.00125000000000000003Initial program 100.0%
Taylor expanded in x around inf 62.2%
mul-1-neg62.2%
unsub-neg62.2%
Simplified62.2%
Taylor expanded in z around 0 60.8%
Final simplification56.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.75e-47) (not (<= x 2e+23))) (* x (+ z 1.0)) (* z (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.75e-47) || !(x <= 2e+23)) {
tmp = x * (z + 1.0);
} else {
tmp = z * -t;
}
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 ((x <= (-3.75d-47)) .or. (.not. (x <= 2d+23))) then
tmp = x * (z + 1.0d0)
else
tmp = z * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.75e-47) || !(x <= 2e+23)) {
tmp = x * (z + 1.0);
} else {
tmp = z * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.75e-47) or not (x <= 2e+23): tmp = x * (z + 1.0) else: tmp = z * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.75e-47) || !(x <= 2e+23)) tmp = Float64(x * Float64(z + 1.0)); else tmp = Float64(z * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.75e-47) || ~((x <= 2e+23))) tmp = x * (z + 1.0); else tmp = z * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.75e-47], N[Not[LessEqual[x, 2e+23]], $MachinePrecision]], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], N[(z * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.75 \cdot 10^{-47} \lor \neg \left(x \leq 2 \cdot 10^{+23}\right):\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\end{array}
\end{array}
if x < -3.74999999999999984e-47 or 1.9999999999999998e23 < x Initial program 100.0%
Taylor expanded in x around inf 80.1%
mul-1-neg80.1%
unsub-neg80.1%
Simplified80.1%
Taylor expanded in y around 0 51.1%
+-commutative51.1%
Simplified51.1%
if -3.74999999999999984e-47 < x < 1.9999999999999998e23Initial program 100.0%
Taylor expanded in y around 0 62.1%
mul-1-neg62.1%
unsub-neg62.1%
Simplified62.1%
Taylor expanded in x around 0 62.1%
Taylor expanded in x around 0 47.9%
mul-1-neg47.9%
*-commutative47.9%
distribute-rgt-neg-in47.9%
Simplified47.9%
Final simplification49.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -0.01) (not (<= y 25000000.0))) (* y (- x)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -0.01) || !(y <= 25000000.0)) {
tmp = y * -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 ((y <= (-0.01d0)) .or. (.not. (y <= 25000000.0d0))) then
tmp = y * -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 ((y <= -0.01) || !(y <= 25000000.0)) {
tmp = y * -x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -0.01) or not (y <= 25000000.0): tmp = y * -x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -0.01) || !(y <= 25000000.0)) tmp = Float64(y * Float64(-x)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -0.01) || ~((y <= 25000000.0))) tmp = y * -x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -0.01], N[Not[LessEqual[y, 25000000.0]], $MachinePrecision]], N[(y * (-x)), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.01 \lor \neg \left(y \leq 25000000\right):\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -0.0100000000000000002 or 2.5e7 < y Initial program 100.0%
Taylor expanded in x around inf 51.2%
mul-1-neg51.2%
unsub-neg51.2%
Simplified51.2%
Taylor expanded in y around inf 39.7%
mul-1-neg39.7%
Simplified39.7%
if -0.0100000000000000002 < y < 2.5e7Initial program 100.0%
Taylor expanded in y around inf 39.6%
*-commutative39.6%
Simplified39.6%
Taylor expanded in y around 0 32.8%
Final simplification36.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -56000.0) (not (<= z 0.022))) (* z x) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -56000.0) || !(z <= 0.022)) {
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 <= (-56000.0d0)) .or. (.not. (z <= 0.022d0))) 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 <= -56000.0) || !(z <= 0.022)) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -56000.0) or not (z <= 0.022): tmp = z * x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -56000.0) || !(z <= 0.022)) tmp = Float64(z * x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -56000.0) || ~((z <= 0.022))) tmp = z * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -56000.0], N[Not[LessEqual[z, 0.022]], $MachinePrecision]], N[(z * x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -56000 \lor \neg \left(z \leq 0.022\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -56000 or 0.021999999999999999 < z Initial program 100.0%
Taylor expanded in x around inf 44.9%
mul-1-neg44.9%
unsub-neg44.9%
Simplified44.9%
Taylor expanded in z around inf 34.0%
if -56000 < z < 0.021999999999999999Initial program 100.0%
Taylor expanded in y around inf 92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in y around 0 32.0%
Final simplification33.0%
(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 (if (<= y 0.38) x (* y x)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.38) {
tmp = x;
} else {
tmp = y * 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 (y <= 0.38d0) then
tmp = x
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.38) {
tmp = x;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 0.38: tmp = x else: tmp = y * x return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 0.38) tmp = x; else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 0.38) tmp = x; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 0.38], x, N[(y * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.38:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if y < 0.38Initial program 100.0%
Taylor expanded in y around inf 53.4%
*-commutative53.4%
Simplified53.4%
Taylor expanded in y around 0 22.7%
if 0.38 < y Initial program 99.9%
Taylor expanded in x around inf 50.4%
mul-1-neg50.4%
unsub-neg50.4%
Simplified50.4%
Taylor expanded in y around inf 37.0%
mul-1-neg37.0%
Simplified37.0%
neg-sub037.0%
sub-neg37.0%
add-sqr-sqrt0.0%
sqrt-unprod13.9%
sqr-neg13.9%
sqrt-unprod8.6%
add-sqr-sqrt8.6%
Applied egg-rr8.6%
+-lft-identity8.6%
Simplified8.6%
Final simplification18.8%
(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.4%
*-commutative58.4%
Simplified58.4%
Taylor expanded in y around 0 16.9%
(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 2024116
(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))))