
(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 11 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 (+ x (* y t))) (t_2 (* z (- x t))) (t_3 (* x (+ (- z y) 1.0))))
(if (<= z -4.4e+129)
t_2
(if (<= z -7.4e-65)
t_3
(if (<= z -2.7e-307)
t_1
(if (<= z 1.5e-229) t_3 (if (<= z 159000000000.0) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (y * t);
double t_2 = z * (x - t);
double t_3 = x * ((z - y) + 1.0);
double tmp;
if (z <= -4.4e+129) {
tmp = t_2;
} else if (z <= -7.4e-65) {
tmp = t_3;
} else if (z <= -2.7e-307) {
tmp = t_1;
} else if (z <= 1.5e-229) {
tmp = t_3;
} else if (z <= 159000000000.0) {
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 = x + (y * t)
t_2 = z * (x - t)
t_3 = x * ((z - y) + 1.0d0)
if (z <= (-4.4d+129)) then
tmp = t_2
else if (z <= (-7.4d-65)) then
tmp = t_3
else if (z <= (-2.7d-307)) then
tmp = t_1
else if (z <= 1.5d-229) then
tmp = t_3
else if (z <= 159000000000.0d0) 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 = x + (y * t);
double t_2 = z * (x - t);
double t_3 = x * ((z - y) + 1.0);
double tmp;
if (z <= -4.4e+129) {
tmp = t_2;
} else if (z <= -7.4e-65) {
tmp = t_3;
} else if (z <= -2.7e-307) {
tmp = t_1;
} else if (z <= 1.5e-229) {
tmp = t_3;
} else if (z <= 159000000000.0) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (y * t) t_2 = z * (x - t) t_3 = x * ((z - y) + 1.0) tmp = 0 if z <= -4.4e+129: tmp = t_2 elif z <= -7.4e-65: tmp = t_3 elif z <= -2.7e-307: tmp = t_1 elif z <= 1.5e-229: tmp = t_3 elif z <= 159000000000.0: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(y * t)) t_2 = Float64(z * Float64(x - t)) t_3 = Float64(x * Float64(Float64(z - y) + 1.0)) tmp = 0.0 if (z <= -4.4e+129) tmp = t_2; elseif (z <= -7.4e-65) tmp = t_3; elseif (z <= -2.7e-307) tmp = t_1; elseif (z <= 1.5e-229) tmp = t_3; elseif (z <= 159000000000.0) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (y * t); t_2 = z * (x - t); t_3 = x * ((z - y) + 1.0); tmp = 0.0; if (z <= -4.4e+129) tmp = t_2; elseif (z <= -7.4e-65) tmp = t_3; elseif (z <= -2.7e-307) tmp = t_1; elseif (z <= 1.5e-229) tmp = t_3; elseif (z <= 159000000000.0) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.4e+129], t$95$2, If[LessEqual[z, -7.4e-65], t$95$3, If[LessEqual[z, -2.7e-307], t$95$1, If[LessEqual[z, 1.5e-229], t$95$3, If[LessEqual[z, 159000000000.0], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot t\\
t_2 := z \cdot \left(x - t\right)\\
t_3 := x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{if}\;z \leq -4.4 \cdot 10^{+129}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -7.4 \cdot 10^{-65}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;z \leq -2.7 \cdot 10^{-307}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-229}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;z \leq 159000000000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -4.3999999999999999e129 or 1.59e11 < z Initial program 100.0%
Taylor expanded in y around 0 82.0%
mul-1-neg82.0%
unsub-neg82.0%
Simplified82.0%
Taylor expanded in z around inf 81.6%
if -4.3999999999999999e129 < z < -7.4e-65 or -2.69999999999999985e-307 < z < 1.50000000000000001e-229Initial program 99.9%
Taylor expanded in x around inf 70.3%
mul-1-neg70.3%
unsub-neg70.3%
Simplified70.3%
if -7.4e-65 < z < -2.69999999999999985e-307 or 1.50000000000000001e-229 < z < 1.59e11Initial program 100.0%
Taylor expanded in t around inf 84.4%
Taylor expanded in y around inf 78.0%
*-commutative78.0%
Simplified78.0%
Final simplification77.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- x))))
(if (<= y -9.4e+117)
t_1
(if (<= y 1.45e+15)
(* x (+ z 1.0))
(if (or (<= y 8.8e+95) (and (not (<= y 5.7e+113)) (<= y 3.2e+219)))
t_1
(* y t))))))
double code(double x, double y, double z, double t) {
double t_1 = y * -x;
double tmp;
if (y <= -9.4e+117) {
tmp = t_1;
} else if (y <= 1.45e+15) {
tmp = x * (z + 1.0);
} else if ((y <= 8.8e+95) || (!(y <= 5.7e+113) && (y <= 3.2e+219))) {
tmp = t_1;
} else {
tmp = y * 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) :: t_1
real(8) :: tmp
t_1 = y * -x
if (y <= (-9.4d+117)) then
tmp = t_1
else if (y <= 1.45d+15) then
tmp = x * (z + 1.0d0)
else if ((y <= 8.8d+95) .or. (.not. (y <= 5.7d+113)) .and. (y <= 3.2d+219)) then
tmp = t_1
else
tmp = y * t
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 (y <= -9.4e+117) {
tmp = t_1;
} else if (y <= 1.45e+15) {
tmp = x * (z + 1.0);
} else if ((y <= 8.8e+95) || (!(y <= 5.7e+113) && (y <= 3.2e+219))) {
tmp = t_1;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * -x tmp = 0 if y <= -9.4e+117: tmp = t_1 elif y <= 1.45e+15: tmp = x * (z + 1.0) elif (y <= 8.8e+95) or (not (y <= 5.7e+113) and (y <= 3.2e+219)): tmp = t_1 else: tmp = y * t return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(-x)) tmp = 0.0 if (y <= -9.4e+117) tmp = t_1; elseif (y <= 1.45e+15) tmp = Float64(x * Float64(z + 1.0)); elseif ((y <= 8.8e+95) || (!(y <= 5.7e+113) && (y <= 3.2e+219))) tmp = t_1; else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * -x; tmp = 0.0; if (y <= -9.4e+117) tmp = t_1; elseif (y <= 1.45e+15) tmp = x * (z + 1.0); elseif ((y <= 8.8e+95) || (~((y <= 5.7e+113)) && (y <= 3.2e+219))) tmp = t_1; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-x)), $MachinePrecision]}, If[LessEqual[y, -9.4e+117], t$95$1, If[LessEqual[y, 1.45e+15], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 8.8e+95], And[N[Not[LessEqual[y, 5.7e+113]], $MachinePrecision], LessEqual[y, 3.2e+219]]], t$95$1, N[(y * t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(-x\right)\\
\mathbf{if}\;y \leq -9.4 \cdot 10^{+117}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+15}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{+95} \lor \neg \left(y \leq 5.7 \cdot 10^{+113}\right) \land y \leq 3.2 \cdot 10^{+219}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -9.40000000000000011e117 or 1.45e15 < y < 8.7999999999999996e95 or 5.6999999999999998e113 < y < 3.20000000000000026e219Initial program 100.0%
Taylor expanded in x around inf 69.7%
mul-1-neg69.7%
unsub-neg69.7%
Simplified69.7%
Taylor expanded in y around inf 59.4%
mul-1-neg59.4%
distribute-lft-neg-out59.4%
*-commutative59.4%
Simplified59.4%
if -9.40000000000000011e117 < y < 1.45e15Initial 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.3%
+-commutative59.3%
Simplified59.3%
if 8.7999999999999996e95 < y < 5.6999999999999998e113 or 3.20000000000000026e219 < y Initial program 100.0%
Taylor expanded in t around inf 85.0%
Taylor expanded in y around inf 78.0%
*-commutative78.0%
Simplified78.0%
Taylor expanded in x around 0 78.0%
*-commutative78.0%
Simplified78.0%
Final simplification60.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))) (t_2 (+ x (* y t))))
(if (<= z -1.65e-19)
t_1
(if (<= z 2.9e-300)
t_2
(if (<= z 6e-230)
(* x (- 1.0 y))
(if (<= z 159000000000.0) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double t_2 = x + (y * t);
double tmp;
if (z <= -1.65e-19) {
tmp = t_1;
} else if (z <= 2.9e-300) {
tmp = t_2;
} else if (z <= 6e-230) {
tmp = x * (1.0 - y);
} else if (z <= 159000000000.0) {
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 = z * (x - t)
t_2 = x + (y * t)
if (z <= (-1.65d-19)) then
tmp = t_1
else if (z <= 2.9d-300) then
tmp = t_2
else if (z <= 6d-230) then
tmp = x * (1.0d0 - y)
else if (z <= 159000000000.0d0) 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 = z * (x - t);
double t_2 = x + (y * t);
double tmp;
if (z <= -1.65e-19) {
tmp = t_1;
} else if (z <= 2.9e-300) {
tmp = t_2;
} else if (z <= 6e-230) {
tmp = x * (1.0 - y);
} else if (z <= 159000000000.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) t_2 = x + (y * t) tmp = 0 if z <= -1.65e-19: tmp = t_1 elif z <= 2.9e-300: tmp = t_2 elif z <= 6e-230: tmp = x * (1.0 - y) elif z <= 159000000000.0: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) t_2 = Float64(x + Float64(y * t)) tmp = 0.0 if (z <= -1.65e-19) tmp = t_1; elseif (z <= 2.9e-300) tmp = t_2; elseif (z <= 6e-230) tmp = Float64(x * Float64(1.0 - y)); elseif (z <= 159000000000.0) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); t_2 = x + (y * t); tmp = 0.0; if (z <= -1.65e-19) tmp = t_1; elseif (z <= 2.9e-300) tmp = t_2; elseif (z <= 6e-230) tmp = x * (1.0 - y); elseif (z <= 159000000000.0) tmp = t_2; 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]}, Block[{t$95$2 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.65e-19], t$95$1, If[LessEqual[z, 2.9e-300], t$95$2, If[LessEqual[z, 6e-230], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 159000000000.0], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
t_2 := x + y \cdot t\\
\mathbf{if}\;z \leq -1.65 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{-300}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-230}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;z \leq 159000000000:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.6499999999999999e-19 or 1.59e11 < z Initial program 100.0%
Taylor expanded in y around 0 76.7%
mul-1-neg76.7%
unsub-neg76.7%
Simplified76.7%
Taylor expanded in z around inf 75.3%
if -1.6499999999999999e-19 < z < 2.89999999999999992e-300 or 6e-230 < z < 1.59e11Initial program 100.0%
Taylor expanded in t around inf 83.8%
Taylor expanded in y around inf 75.4%
*-commutative75.4%
Simplified75.4%
if 2.89999999999999992e-300 < z < 6e-230Initial program 100.0%
Taylor expanded in x around inf 79.0%
mul-1-neg79.0%
unsub-neg79.0%
Simplified79.0%
Taylor expanded in z around 0 79.0%
Final simplification75.6%
(FPCore (x y z t) :precision binary64 (if (<= z -1.02e-5) (* z x) (if (<= z 1.32e-225) x (if (<= z 4.5e+80) (* y t) (* z x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.02e-5) {
tmp = z * x;
} else if (z <= 1.32e-225) {
tmp = x;
} else if (z <= 4.5e+80) {
tmp = y * t;
} 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) :: tmp
if (z <= (-1.02d-5)) then
tmp = z * x
else if (z <= 1.32d-225) then
tmp = x
else if (z <= 4.5d+80) then
tmp = y * t
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.02e-5) {
tmp = z * x;
} else if (z <= 1.32e-225) {
tmp = x;
} else if (z <= 4.5e+80) {
tmp = y * t;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.02e-5: tmp = z * x elif z <= 1.32e-225: tmp = x elif z <= 4.5e+80: tmp = y * t else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.02e-5) tmp = Float64(z * x); elseif (z <= 1.32e-225) tmp = x; elseif (z <= 4.5e+80) tmp = Float64(y * t); else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.02e-5) tmp = z * x; elseif (z <= 1.32e-225) tmp = x; elseif (z <= 4.5e+80) tmp = y * t; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.02e-5], N[(z * x), $MachinePrecision], If[LessEqual[z, 1.32e-225], x, If[LessEqual[z, 4.5e+80], N[(y * t), $MachinePrecision], N[(z * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{-5}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq 1.32 \cdot 10^{-225}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+80}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1.0200000000000001e-5 or 4.50000000000000007e80 < z Initial program 100.0%
Taylor expanded in x around inf 65.8%
mul-1-neg65.8%
unsub-neg65.8%
Simplified65.8%
Taylor expanded in z around inf 51.4%
if -1.0200000000000001e-5 < z < 1.32e-225Initial program 100.0%
Taylor expanded in t around inf 77.7%
Taylor expanded in x around inf 42.7%
if 1.32e-225 < z < 4.50000000000000007e80Initial program 100.0%
Taylor expanded in t around inf 77.1%
Taylor expanded in y around inf 62.5%
*-commutative62.5%
Simplified62.5%
Taylor expanded in x around 0 38.5%
*-commutative38.5%
Simplified38.5%
Final simplification45.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.2e+54) (not (<= t 7.2e+37))) (+ x (* (- y z) t)) (* x (+ (- z y) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.2e+54) || !(t <= 7.2e+37)) {
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 <= (-5.2d+54)) .or. (.not. (t <= 7.2d+37))) 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 <= -5.2e+54) || !(t <= 7.2e+37)) {
tmp = x + ((y - z) * t);
} else {
tmp = x * ((z - y) + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.2e+54) or not (t <= 7.2e+37): 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 <= -5.2e+54) || !(t <= 7.2e+37)) 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 <= -5.2e+54) || ~((t <= 7.2e+37))) 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, -5.2e+54], N[Not[LessEqual[t, 7.2e+37]], $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 -5.2 \cdot 10^{+54} \lor \neg \left(t \leq 7.2 \cdot 10^{+37}\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 < -5.20000000000000013e54 or 7.19999999999999995e37 < t Initial program 100.0%
Taylor expanded in t around inf 92.8%
if -5.20000000000000013e54 < t < 7.19999999999999995e37Initial program 100.0%
Taylor expanded in x around inf 82.7%
mul-1-neg82.7%
unsub-neg82.7%
Simplified82.7%
Final simplification86.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1e-5) (not (<= z 159000000000.0))) (* z (- x t)) (* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1e-5) || !(z <= 159000000000.0)) {
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 <= (-1d-5)) .or. (.not. (z <= 159000000000.0d0))) 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 <= -1e-5) || !(z <= 159000000000.0)) {
tmp = z * (x - t);
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1e-5) or not (z <= 159000000000.0): tmp = z * (x - t) else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1e-5) || !(z <= 159000000000.0)) 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 <= -1e-5) || ~((z <= 159000000000.0))) tmp = z * (x - t); else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1e-5], N[Not[LessEqual[z, 159000000000.0]], $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 -1 \cdot 10^{-5} \lor \neg \left(z \leq 159000000000\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if z < -1.00000000000000008e-5 or 1.59e11 < z Initial program 100.0%
Taylor expanded in y around 0 76.9%
mul-1-neg76.9%
unsub-neg76.9%
Simplified76.9%
Taylor expanded in z around inf 76.3%
if -1.00000000000000008e-5 < z < 1.59e11Initial program 100.0%
Taylor expanded in x around inf 62.5%
mul-1-neg62.5%
unsub-neg62.5%
Simplified62.5%
Taylor expanded in z around 0 61.9%
Final simplification69.3%
(FPCore (x y z t) :precision binary64 (if (<= z -18000000.0) (* x (+ z 1.0)) (if (<= z 5e+116) (* x (- 1.0 y)) (* z x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -18000000.0) {
tmp = x * (z + 1.0);
} else if (z <= 5e+116) {
tmp = x * (1.0 - y);
} 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) :: tmp
if (z <= (-18000000.0d0)) then
tmp = x * (z + 1.0d0)
else if (z <= 5d+116) then
tmp = x * (1.0d0 - y)
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -18000000.0) {
tmp = x * (z + 1.0);
} else if (z <= 5e+116) {
tmp = x * (1.0 - y);
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -18000000.0: tmp = x * (z + 1.0) elif z <= 5e+116: tmp = x * (1.0 - y) else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -18000000.0) tmp = Float64(x * Float64(z + 1.0)); elseif (z <= 5e+116) tmp = Float64(x * Float64(1.0 - y)); else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -18000000.0) tmp = x * (z + 1.0); elseif (z <= 5e+116) tmp = x * (1.0 - y); else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -18000000.0], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e+116], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(z * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -18000000:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+116}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1.8e7Initial program 99.9%
Taylor expanded in x around inf 62.8%
mul-1-neg62.8%
unsub-neg62.8%
Simplified62.8%
Taylor expanded in y around 0 46.3%
+-commutative46.3%
Simplified46.3%
if -1.8e7 < z < 5.00000000000000025e116Initial program 100.0%
Taylor expanded in x around inf 59.9%
mul-1-neg59.9%
unsub-neg59.9%
Simplified59.9%
Taylor expanded in z around 0 55.8%
if 5.00000000000000025e116 < z Initial program 100.0%
Taylor expanded in x around inf 72.6%
mul-1-neg72.6%
unsub-neg72.6%
Simplified72.6%
Taylor expanded in z around inf 70.0%
Final simplification56.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.02e-5) (not (<= z 159000000000.0))) (* z x) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.02e-5) || !(z <= 159000000000.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 <= (-1.02d-5)) .or. (.not. (z <= 159000000000.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 <= -1.02e-5) || !(z <= 159000000000.0)) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.02e-5) or not (z <= 159000000000.0): tmp = z * x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.02e-5) || !(z <= 159000000000.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 <= -1.02e-5) || ~((z <= 159000000000.0))) tmp = z * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.02e-5], N[Not[LessEqual[z, 159000000000.0]], $MachinePrecision]], N[(z * x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{-5} \lor \neg \left(z \leq 159000000000\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.0200000000000001e-5 or 1.59e11 < z Initial program 100.0%
Taylor expanded in x around inf 62.7%
mul-1-neg62.7%
unsub-neg62.7%
Simplified62.7%
Taylor expanded in z around inf 47.1%
if -1.0200000000000001e-5 < z < 1.59e11Initial program 100.0%
Taylor expanded in t around inf 79.2%
Taylor expanded in x around inf 40.3%
Final simplification43.8%
(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 63.2%
Taylor expanded in x around inf 21.3%
Final simplification21.3%
(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 2024068
(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))))