
(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 13 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%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))) (t_2 (* y (- x))) (t_3 (* x (+ z 1.0))))
(if (<= y -17500.0)
t_2
(if (<= y -2.5e-200)
t_3
(if (<= y 1.6e-297)
t_1
(if (<= y 2.4e-199)
t_3
(if (<= y 1.8e-107)
t_1
(if (<= y 2.1e-9) t_3 (if (<= y 4.6e+102) t_1 t_2)))))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double t_2 = y * -x;
double t_3 = x * (z + 1.0);
double tmp;
if (y <= -17500.0) {
tmp = t_2;
} else if (y <= -2.5e-200) {
tmp = t_3;
} else if (y <= 1.6e-297) {
tmp = t_1;
} else if (y <= 2.4e-199) {
tmp = t_3;
} else if (y <= 1.8e-107) {
tmp = t_1;
} else if (y <= 2.1e-9) {
tmp = t_3;
} else if (y <= 4.6e+102) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_3
real(8) :: tmp
t_1 = z * -t
t_2 = y * -x
t_3 = x * (z + 1.0d0)
if (y <= (-17500.0d0)) then
tmp = t_2
else if (y <= (-2.5d-200)) then
tmp = t_3
else if (y <= 1.6d-297) then
tmp = t_1
else if (y <= 2.4d-199) then
tmp = t_3
else if (y <= 1.8d-107) then
tmp = t_1
else if (y <= 2.1d-9) then
tmp = t_3
else if (y <= 4.6d+102) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double t_2 = y * -x;
double t_3 = x * (z + 1.0);
double tmp;
if (y <= -17500.0) {
tmp = t_2;
} else if (y <= -2.5e-200) {
tmp = t_3;
} else if (y <= 1.6e-297) {
tmp = t_1;
} else if (y <= 2.4e-199) {
tmp = t_3;
} else if (y <= 1.8e-107) {
tmp = t_1;
} else if (y <= 2.1e-9) {
tmp = t_3;
} else if (y <= 4.6e+102) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t t_2 = y * -x t_3 = x * (z + 1.0) tmp = 0 if y <= -17500.0: tmp = t_2 elif y <= -2.5e-200: tmp = t_3 elif y <= 1.6e-297: tmp = t_1 elif y <= 2.4e-199: tmp = t_3 elif y <= 1.8e-107: tmp = t_1 elif y <= 2.1e-9: tmp = t_3 elif y <= 4.6e+102: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) t_2 = Float64(y * Float64(-x)) t_3 = Float64(x * Float64(z + 1.0)) tmp = 0.0 if (y <= -17500.0) tmp = t_2; elseif (y <= -2.5e-200) tmp = t_3; elseif (y <= 1.6e-297) tmp = t_1; elseif (y <= 2.4e-199) tmp = t_3; elseif (y <= 1.8e-107) tmp = t_1; elseif (y <= 2.1e-9) tmp = t_3; elseif (y <= 4.6e+102) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; t_2 = y * -x; t_3 = x * (z + 1.0); tmp = 0.0; if (y <= -17500.0) tmp = t_2; elseif (y <= -2.5e-200) tmp = t_3; elseif (y <= 1.6e-297) tmp = t_1; elseif (y <= 2.4e-199) tmp = t_3; elseif (y <= 1.8e-107) tmp = t_1; elseif (y <= 2.1e-9) tmp = t_3; elseif (y <= 4.6e+102) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, Block[{t$95$2 = N[(y * (-x)), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -17500.0], t$95$2, If[LessEqual[y, -2.5e-200], t$95$3, If[LessEqual[y, 1.6e-297], t$95$1, If[LessEqual[y, 2.4e-199], t$95$3, If[LessEqual[y, 1.8e-107], t$95$1, If[LessEqual[y, 2.1e-9], t$95$3, If[LessEqual[y, 4.6e+102], t$95$1, t$95$2]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
t_2 := y \cdot \left(-x\right)\\
t_3 := x \cdot \left(z + 1\right)\\
\mathbf{if}\;y \leq -17500:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -2.5 \cdot 10^{-200}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{-297}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{-199}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-107}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{-9}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{+102}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -17500 or 4.5999999999999998e102 < y Initial program 100.0%
Taylor expanded in x around inf 57.5%
mul-1-neg57.5%
unsub-neg57.5%
Simplified57.5%
Taylor expanded in z around 0 52.1%
Taylor expanded in y around inf 51.6%
associate-*r*51.6%
mul-1-neg51.6%
Simplified51.6%
if -17500 < y < -2.49999999999999996e-200 or 1.59999999999999986e-297 < y < 2.39999999999999996e-199 or 1.79999999999999988e-107 < y < 2.10000000000000019e-9Initial program 100.0%
Taylor expanded in x around inf 63.5%
mul-1-neg63.5%
unsub-neg63.5%
Simplified63.5%
Taylor expanded in y around 0 63.4%
+-commutative63.4%
Simplified63.4%
if -2.49999999999999996e-200 < y < 1.59999999999999986e-297 or 2.39999999999999996e-199 < y < 1.79999999999999988e-107 or 2.10000000000000019e-9 < y < 4.5999999999999998e102Initial program 99.9%
Taylor expanded in y around 0 84.8%
mul-1-neg84.8%
unsub-neg84.8%
Simplified84.8%
Taylor expanded in x around 0 84.8%
Taylor expanded in x around 0 55.0%
associate-*r*55.0%
neg-mul-155.0%
Simplified55.0%
Final simplification55.9%
(FPCore (x y z t)
:precision binary64
(if (or (<= t -3.1e-21)
(and (not (<= t -4.8e-80)) (or (<= t -9e-96) (not (<= t 8.2e+21)))))
(+ x (* (- y z) t))
(* x (+ (- z y) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.1e-21) || (!(t <= -4.8e-80) && ((t <= -9e-96) || !(t <= 8.2e+21)))) {
tmp = x + ((y - z) * t);
} else {
tmp = x * ((z - y) + 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 <= (-3.1d-21)) .or. (.not. (t <= (-4.8d-80))) .and. (t <= (-9d-96)) .or. (.not. (t <= 8.2d+21))) then
tmp = x + ((y - z) * t)
else
tmp = x * ((z - y) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.1e-21) || (!(t <= -4.8e-80) && ((t <= -9e-96) || !(t <= 8.2e+21)))) {
tmp = x + ((y - z) * t);
} else {
tmp = x * ((z - y) + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.1e-21) or (not (t <= -4.8e-80) and ((t <= -9e-96) or not (t <= 8.2e+21))): tmp = x + ((y - z) * t) else: tmp = x * ((z - y) + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.1e-21) || (!(t <= -4.8e-80) && ((t <= -9e-96) || !(t <= 8.2e+21)))) tmp = Float64(x + Float64(Float64(y - z) * t)); else tmp = Float64(x * Float64(Float64(z - y) + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3.1e-21) || (~((t <= -4.8e-80)) && ((t <= -9e-96) || ~((t <= 8.2e+21))))) tmp = x + ((y - z) * t); else tmp = x * ((z - y) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.1e-21], And[N[Not[LessEqual[t, -4.8e-80]], $MachinePrecision], Or[LessEqual[t, -9e-96], N[Not[LessEqual[t, 8.2e+21]], $MachinePrecision]]]], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.1 \cdot 10^{-21} \lor \neg \left(t \leq -4.8 \cdot 10^{-80}\right) \land \left(t \leq -9 \cdot 10^{-96} \lor \neg \left(t \leq 8.2 \cdot 10^{+21}\right)\right):\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\end{array}
\end{array}
if t < -3.0999999999999998e-21 or -4.7999999999999998e-80 < t < -9e-96 or 8.2e21 < t Initial program 100.0%
Taylor expanded in t around inf 85.3%
if -3.0999999999999998e-21 < t < -4.7999999999999998e-80 or -9e-96 < t < 8.2e21Initial program 99.9%
Taylor expanded in x around inf 82.2%
mul-1-neg82.2%
unsub-neg82.2%
Simplified82.2%
Final simplification83.9%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -4.8e+80)
(and (not (<= z -8e+58)) (or (<= z -14500.0) (not (<= z 2.3e+17)))))
(* z (- x t))
(+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.8e+80) || (!(z <= -8e+58) && ((z <= -14500.0) || !(z <= 2.3e+17)))) {
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 <= (-4.8d+80)) .or. (.not. (z <= (-8d+58))) .and. (z <= (-14500.0d0)) .or. (.not. (z <= 2.3d+17))) 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 <= -4.8e+80) || (!(z <= -8e+58) && ((z <= -14500.0) || !(z <= 2.3e+17)))) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.8e+80) or (not (z <= -8e+58) and ((z <= -14500.0) or not (z <= 2.3e+17))): tmp = z * (x - t) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.8e+80) || (!(z <= -8e+58) && ((z <= -14500.0) || !(z <= 2.3e+17)))) 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 <= -4.8e+80) || (~((z <= -8e+58)) && ((z <= -14500.0) || ~((z <= 2.3e+17))))) tmp = z * (x - t); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.8e+80], And[N[Not[LessEqual[z, -8e+58]], $MachinePrecision], Or[LessEqual[z, -14500.0], N[Not[LessEqual[z, 2.3e+17]], $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 -4.8 \cdot 10^{+80} \lor \neg \left(z \leq -8 \cdot 10^{+58}\right) \land \left(z \leq -14500 \lor \neg \left(z \leq 2.3 \cdot 10^{+17}\right)\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -4.79999999999999958e80 or -7.99999999999999955e58 < z < -14500 or 2.3e17 < z Initial program 99.9%
Taylor expanded in y around 0 82.1%
mul-1-neg82.1%
unsub-neg82.1%
Simplified82.1%
Taylor expanded in x around 0 78.2%
Taylor expanded in z around inf 81.6%
if -4.79999999999999958e80 < z < -7.99999999999999955e58 or -14500 < z < 2.3e17Initial program 100.0%
Taylor expanded in y around inf 90.5%
*-commutative90.5%
Simplified90.5%
Final simplification86.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))) (t_2 (+ x (* y (- t x)))))
(if (<= y -5.2e-10)
t_2
(if (<= y 1.6e-29)
(+ x t_1)
(if (<= y 8e+40) (+ x (* (- y z) t)) (if (<= y 3.5e+102) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double t_2 = x + (y * (t - x));
double tmp;
if (y <= -5.2e-10) {
tmp = t_2;
} else if (y <= 1.6e-29) {
tmp = x + t_1;
} else if (y <= 8e+40) {
tmp = x + ((y - z) * t);
} else if (y <= 3.5e+102) {
tmp = t_1;
} else {
tmp = t_2;
}
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 = z * (x - t)
t_2 = x + (y * (t - x))
if (y <= (-5.2d-10)) then
tmp = t_2
else if (y <= 1.6d-29) then
tmp = x + t_1
else if (y <= 8d+40) then
tmp = x + ((y - z) * t)
else if (y <= 3.5d+102) then
tmp = t_1
else
tmp = t_2
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 t_2 = x + (y * (t - x));
double tmp;
if (y <= -5.2e-10) {
tmp = t_2;
} else if (y <= 1.6e-29) {
tmp = x + t_1;
} else if (y <= 8e+40) {
tmp = x + ((y - z) * t);
} else if (y <= 3.5e+102) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) t_2 = x + (y * (t - x)) tmp = 0 if y <= -5.2e-10: tmp = t_2 elif y <= 1.6e-29: tmp = x + t_1 elif y <= 8e+40: tmp = x + ((y - z) * t) elif y <= 3.5e+102: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) t_2 = Float64(x + Float64(y * Float64(t - x))) tmp = 0.0 if (y <= -5.2e-10) tmp = t_2; elseif (y <= 1.6e-29) tmp = Float64(x + t_1); elseif (y <= 8e+40) tmp = Float64(x + Float64(Float64(y - z) * t)); elseif (y <= 3.5e+102) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); t_2 = x + (y * (t - x)); tmp = 0.0; if (y <= -5.2e-10) tmp = t_2; elseif (y <= 1.6e-29) tmp = x + t_1; elseif (y <= 8e+40) tmp = x + ((y - z) * t); elseif (y <= 3.5e+102) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.2e-10], t$95$2, If[LessEqual[y, 1.6e-29], N[(x + t$95$1), $MachinePrecision], If[LessEqual[y, 8e+40], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.5e+102], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
t_2 := x + y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -5.2 \cdot 10^{-10}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{-29}:\\
\;\;\;\;x + t\_1\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+40}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+102}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -5.19999999999999962e-10 or 3.50000000000000011e102 < y Initial program 100.0%
Taylor expanded in y around inf 86.3%
*-commutative86.3%
Simplified86.3%
if -5.19999999999999962e-10 < y < 1.6e-29Initial program 100.0%
Taylor expanded in y around 0 95.6%
mul-1-neg95.6%
unsub-neg95.6%
Simplified95.6%
if 1.6e-29 < y < 8.00000000000000024e40Initial program 99.9%
Taylor expanded in t around inf 92.9%
if 8.00000000000000024e40 < y < 3.50000000000000011e102Initial program 99.9%
Taylor expanded in y around 0 73.8%
mul-1-neg73.8%
unsub-neg73.8%
Simplified73.8%
Taylor expanded in x around 0 73.8%
Taylor expanded in z around inf 74.0%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5000000000.0) (not (<= z 8e+15))) (* z (- x t)) (* x (+ (- z y) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5000000000.0) || !(z <= 8e+15)) {
tmp = z * (x - t);
} else {
tmp = x * ((z - y) + 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 ((z <= (-5000000000.0d0)) .or. (.not. (z <= 8d+15))) then
tmp = z * (x - t)
else
tmp = x * ((z - y) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5000000000.0) || !(z <= 8e+15)) {
tmp = z * (x - t);
} else {
tmp = x * ((z - y) + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5000000000.0) or not (z <= 8e+15): tmp = z * (x - t) else: tmp = x * ((z - y) + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5000000000.0) || !(z <= 8e+15)) tmp = Float64(z * Float64(x - t)); else tmp = Float64(x * Float64(Float64(z - y) + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5000000000.0) || ~((z <= 8e+15))) tmp = z * (x - t); else tmp = x * ((z - y) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5000000000.0], N[Not[LessEqual[z, 8e+15]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5000000000 \lor \neg \left(z \leq 8 \cdot 10^{+15}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\end{array}
\end{array}
if z < -5e9 or 8e15 < z Initial program 99.9%
Taylor expanded in y around 0 78.2%
mul-1-neg78.2%
unsub-neg78.2%
Simplified78.2%
Taylor expanded in x around 0 74.4%
Taylor expanded in z around inf 78.2%
if -5e9 < z < 8e15Initial program 100.0%
Taylor expanded in x around inf 61.5%
mul-1-neg61.5%
unsub-neg61.5%
Simplified61.5%
Final simplification70.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -155000000.0) (not (<= z 1.7e+16))) (* z (- t)) (* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -155000000.0) || !(z <= 1.7e+16)) {
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 <= (-155000000.0d0)) .or. (.not. (z <= 1.7d+16))) 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 <= -155000000.0) || !(z <= 1.7e+16)) {
tmp = z * -t;
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -155000000.0) or not (z <= 1.7e+16): tmp = z * -t else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -155000000.0) || !(z <= 1.7e+16)) 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 <= -155000000.0) || ~((z <= 1.7e+16))) tmp = z * -t; else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -155000000.0], N[Not[LessEqual[z, 1.7e+16]], $MachinePrecision]], N[(z * (-t)), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -155000000 \lor \neg \left(z \leq 1.7 \cdot 10^{+16}\right):\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if z < -1.55e8 or 1.7e16 < z Initial program 99.9%
Taylor expanded in y around 0 78.2%
mul-1-neg78.2%
unsub-neg78.2%
Simplified78.2%
Taylor expanded in x around 0 74.4%
Taylor expanded in x around 0 49.3%
associate-*r*49.3%
neg-mul-149.3%
Simplified49.3%
if -1.55e8 < z < 1.7e16Initial program 100.0%
Taylor expanded in x around inf 61.5%
mul-1-neg61.5%
unsub-neg61.5%
Simplified61.5%
Taylor expanded in z around 0 59.3%
Final simplification54.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.0028) (not (<= z 4.8e+15))) (* z (- x t)) (* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.0028) || !(z <= 4.8e+15)) {
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 <= (-0.0028d0)) .or. (.not. (z <= 4.8d+15))) 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 <= -0.0028) || !(z <= 4.8e+15)) {
tmp = z * (x - t);
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.0028) or not (z <= 4.8e+15): tmp = z * (x - t) else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.0028) || !(z <= 4.8e+15)) 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 <= -0.0028) || ~((z <= 4.8e+15))) tmp = z * (x - t); else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.0028], N[Not[LessEqual[z, 4.8e+15]], $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 -0.0028 \lor \neg \left(z \leq 4.8 \cdot 10^{+15}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if z < -0.00279999999999999997 or 4.8e15 < z Initial program 99.9%
Taylor expanded in y around 0 77.9%
mul-1-neg77.9%
unsub-neg77.9%
Simplified77.9%
Taylor expanded in x around 0 74.2%
Taylor expanded in z around inf 77.5%
if -0.00279999999999999997 < z < 4.8e15Initial program 100.0%
Taylor expanded in x around inf 61.4%
mul-1-neg61.4%
unsub-neg61.4%
Simplified61.4%
Taylor expanded in z around 0 60.0%
Final simplification69.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.0011) (not (<= z 6.2e-36))) (* z (- t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.0011) || !(z <= 6.2e-36)) {
tmp = z * -t;
} 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 <= (-0.0011d0)) .or. (.not. (z <= 6.2d-36))) then
tmp = z * -t
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 <= -0.0011) || !(z <= 6.2e-36)) {
tmp = z * -t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.0011) or not (z <= 6.2e-36): tmp = z * -t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.0011) || !(z <= 6.2e-36)) tmp = Float64(z * Float64(-t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -0.0011) || ~((z <= 6.2e-36))) tmp = z * -t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.0011], N[Not[LessEqual[z, 6.2e-36]], $MachinePrecision]], N[(z * (-t)), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0011 \lor \neg \left(z \leq 6.2 \cdot 10^{-36}\right):\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.00110000000000000007 or 6.1999999999999997e-36 < z Initial program 99.9%
Taylor expanded in y around 0 75.5%
mul-1-neg75.5%
unsub-neg75.5%
Simplified75.5%
Taylor expanded in x around 0 72.1%
Taylor expanded in x around 0 46.6%
associate-*r*46.6%
neg-mul-146.6%
Simplified46.6%
if -0.00110000000000000007 < z < 6.1999999999999997e-36Initial program 100.0%
Taylor expanded in t around inf 66.9%
Taylor expanded in x around inf 28.0%
Final simplification38.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.8e+23) (not (<= y 2.5e+103))) (* y (- x)) (* z (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.8e+23) || !(y <= 2.5e+103)) {
tmp = y * -x;
} 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 ((y <= (-1.8d+23)) .or. (.not. (y <= 2.5d+103))) then
tmp = y * -x
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 ((y <= -1.8e+23) || !(y <= 2.5e+103)) {
tmp = y * -x;
} else {
tmp = z * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.8e+23) or not (y <= 2.5e+103): tmp = y * -x else: tmp = z * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.8e+23) || !(y <= 2.5e+103)) tmp = Float64(y * Float64(-x)); else tmp = Float64(z * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.8e+23) || ~((y <= 2.5e+103))) tmp = y * -x; else tmp = z * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.8e+23], N[Not[LessEqual[y, 2.5e+103]], $MachinePrecision]], N[(y * (-x)), $MachinePrecision], N[(z * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{+23} \lor \neg \left(y \leq 2.5 \cdot 10^{+103}\right):\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\end{array}
\end{array}
if y < -1.7999999999999999e23 or 2.5e103 < y Initial program 100.0%
Taylor expanded in x around inf 58.6%
mul-1-neg58.6%
unsub-neg58.6%
Simplified58.6%
Taylor expanded in z around 0 52.9%
Taylor expanded in y around inf 52.9%
associate-*r*52.9%
mul-1-neg52.9%
Simplified52.9%
if -1.7999999999999999e23 < y < 2.5e103Initial program 99.9%
Taylor expanded in y around 0 87.0%
mul-1-neg87.0%
unsub-neg87.0%
Simplified87.0%
Taylor expanded in x around 0 84.3%
Taylor expanded in x around 0 42.5%
associate-*r*42.5%
neg-mul-142.5%
Simplified42.5%
Final simplification47.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -20000.0) (not (<= z 7.0))) (* z x) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -20000.0) || !(z <= 7.0)) {
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 <= (-20000.0d0)) .or. (.not. (z <= 7.0d0))) 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 <= -20000.0) || !(z <= 7.0)) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -20000.0) or not (z <= 7.0): tmp = z * x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -20000.0) || !(z <= 7.0)) tmp = Float64(z * x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -20000.0) || ~((z <= 7.0))) tmp = z * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -20000.0], N[Not[LessEqual[z, 7.0]], $MachinePrecision]], N[(z * x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -20000 \lor \neg \left(z \leq 7\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2e4 or 7 < z Initial program 99.9%
Taylor expanded in x around inf 47.3%
mul-1-neg47.3%
unsub-neg47.3%
Simplified47.3%
associate--r-47.3%
distribute-rgt-in42.1%
Applied egg-rr42.1%
Taylor expanded in z around inf 33.2%
if -2e4 < z < 7Initial program 100.0%
Taylor expanded in t around inf 67.1%
Taylor expanded in x around inf 27.3%
Final simplification30.4%
(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%
Final simplification100.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 t around inf 62.6%
Taylor expanded in x around inf 14.2%
Final simplification14.2%
(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 2024054
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:alt
(+ x (+ (* t (- y z)) (* (- x) (- y z))))
(+ x (* (- y z) (- t x))))