
(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%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.32e-20)
(* y t)
(if (<= y 1.45e-6)
x
(if (<= y 1.9e+63)
(* z (- t))
(if (or (<= y 2.55e+205) (not (<= y 1.2e+222))) (* y (- x)) (* y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.32e-20) {
tmp = y * t;
} else if (y <= 1.45e-6) {
tmp = x;
} else if (y <= 1.9e+63) {
tmp = z * -t;
} else if ((y <= 2.55e+205) || !(y <= 1.2e+222)) {
tmp = y * -x;
} 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) :: tmp
if (y <= (-1.32d-20)) then
tmp = y * t
else if (y <= 1.45d-6) then
tmp = x
else if (y <= 1.9d+63) then
tmp = z * -t
else if ((y <= 2.55d+205) .or. (.not. (y <= 1.2d+222))) then
tmp = y * -x
else
tmp = y * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.32e-20) {
tmp = y * t;
} else if (y <= 1.45e-6) {
tmp = x;
} else if (y <= 1.9e+63) {
tmp = z * -t;
} else if ((y <= 2.55e+205) || !(y <= 1.2e+222)) {
tmp = y * -x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.32e-20: tmp = y * t elif y <= 1.45e-6: tmp = x elif y <= 1.9e+63: tmp = z * -t elif (y <= 2.55e+205) or not (y <= 1.2e+222): tmp = y * -x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.32e-20) tmp = Float64(y * t); elseif (y <= 1.45e-6) tmp = x; elseif (y <= 1.9e+63) tmp = Float64(z * Float64(-t)); elseif ((y <= 2.55e+205) || !(y <= 1.2e+222)) tmp = Float64(y * Float64(-x)); else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.32e-20) tmp = y * t; elseif (y <= 1.45e-6) tmp = x; elseif (y <= 1.9e+63) tmp = z * -t; elseif ((y <= 2.55e+205) || ~((y <= 1.2e+222))) tmp = y * -x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.32e-20], N[(y * t), $MachinePrecision], If[LessEqual[y, 1.45e-6], x, If[LessEqual[y, 1.9e+63], N[(z * (-t)), $MachinePrecision], If[Or[LessEqual[y, 2.55e+205], N[Not[LessEqual[y, 1.2e+222]], $MachinePrecision]], N[(y * (-x)), $MachinePrecision], N[(y * t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.32 \cdot 10^{-20}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-6}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+63}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{elif}\;y \leq 2.55 \cdot 10^{+205} \lor \neg \left(y \leq 1.2 \cdot 10^{+222}\right):\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -1.32000000000000004e-20 or 2.55e205 < y < 1.2000000000000001e222Initial program 100.0%
Taylor expanded in t around inf 60.7%
Taylor expanded in y around inf 50.8%
*-commutative50.8%
Simplified50.8%
Taylor expanded in x around 0 50.0%
if -1.32000000000000004e-20 < y < 1.4500000000000001e-6Initial program 100.0%
Taylor expanded in t around inf 71.0%
Taylor expanded in x around inf 37.7%
if 1.4500000000000001e-6 < y < 1.9000000000000001e63Initial program 100.0%
Taylor expanded in y around 0 86.0%
mul-1-neg86.0%
unsub-neg86.0%
Simplified86.0%
Taylor expanded in t around inf 37.9%
Taylor expanded in x around 0 37.8%
associate-*r*37.8%
neg-mul-137.8%
*-commutative37.8%
Simplified37.8%
if 1.9000000000000001e63 < y < 2.55e205 or 1.2000000000000001e222 < y Initial program 100.0%
Taylor expanded in y around inf 84.0%
*-commutative84.0%
Simplified84.0%
Taylor expanded in x around inf 55.9%
neg-mul-155.9%
unsub-neg55.9%
Simplified55.9%
Taylor expanded in y around inf 55.9%
mul-1-neg55.9%
distribute-rgt-neg-out55.9%
Simplified55.9%
Final simplification44.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* z x))) (t_2 (+ x (* y t))))
(if (<= x -2e+51)
t_1
(if (<= x 6.2e-300)
t_2
(if (<= x 7e-263) (- x (* z t)) (if (<= x 620000000.0) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (z * x);
double t_2 = x + (y * t);
double tmp;
if (x <= -2e+51) {
tmp = t_1;
} else if (x <= 6.2e-300) {
tmp = t_2;
} else if (x <= 7e-263) {
tmp = x - (z * t);
} else if (x <= 620000000.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 = x + (z * x)
t_2 = x + (y * t)
if (x <= (-2d+51)) then
tmp = t_1
else if (x <= 6.2d-300) then
tmp = t_2
else if (x <= 7d-263) then
tmp = x - (z * t)
else if (x <= 620000000.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 = x + (z * x);
double t_2 = x + (y * t);
double tmp;
if (x <= -2e+51) {
tmp = t_1;
} else if (x <= 6.2e-300) {
tmp = t_2;
} else if (x <= 7e-263) {
tmp = x - (z * t);
} else if (x <= 620000000.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (z * x) t_2 = x + (y * t) tmp = 0 if x <= -2e+51: tmp = t_1 elif x <= 6.2e-300: tmp = t_2 elif x <= 7e-263: tmp = x - (z * t) elif x <= 620000000.0: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(z * x)) t_2 = Float64(x + Float64(y * t)) tmp = 0.0 if (x <= -2e+51) tmp = t_1; elseif (x <= 6.2e-300) tmp = t_2; elseif (x <= 7e-263) tmp = Float64(x - Float64(z * t)); elseif (x <= 620000000.0) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (z * x); t_2 = x + (y * t); tmp = 0.0; if (x <= -2e+51) tmp = t_1; elseif (x <= 6.2e-300) tmp = t_2; elseif (x <= 7e-263) tmp = x - (z * t); elseif (x <= 620000000.0) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2e+51], t$95$1, If[LessEqual[x, 6.2e-300], t$95$2, If[LessEqual[x, 7e-263], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 620000000.0], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + z \cdot x\\
t_2 := x + y \cdot t\\
\mathbf{if}\;x \leq -2 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{-300}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-263}:\\
\;\;\;\;x - z \cdot t\\
\mathbf{elif}\;x \leq 620000000:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2e51 or 6.2e8 < x Initial program 100.0%
Taylor expanded in t around 0 86.2%
mul-1-neg86.2%
distribute-rgt-neg-in86.2%
neg-sub086.2%
sub-neg86.2%
+-commutative86.2%
associate--r+86.2%
neg-sub086.2%
remove-double-neg86.2%
Simplified86.2%
Taylor expanded in z around inf 61.5%
if -2e51 < x < 6.2000000000000005e-300 or 6.99999999999999938e-263 < x < 6.2e8Initial program 100.0%
Taylor expanded in t around inf 80.9%
Taylor expanded in y around inf 61.7%
*-commutative61.7%
Simplified61.7%
if 6.2000000000000005e-300 < x < 6.99999999999999938e-263Initial program 100.0%
Taylor expanded in y around 0 88.1%
mul-1-neg88.1%
unsub-neg88.1%
Simplified88.1%
Taylor expanded in t around inf 88.1%
Final simplification62.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* z x))) (t_2 (+ x (* y t))))
(if (<= x -1.95e+51)
t_1
(if (<= x 3.3e-299)
t_2
(if (<= x 1.25e-262) (* z (- t)) (if (<= x 550000000.0) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (z * x);
double t_2 = x + (y * t);
double tmp;
if (x <= -1.95e+51) {
tmp = t_1;
} else if (x <= 3.3e-299) {
tmp = t_2;
} else if (x <= 1.25e-262) {
tmp = z * -t;
} else if (x <= 550000000.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 = x + (z * x)
t_2 = x + (y * t)
if (x <= (-1.95d+51)) then
tmp = t_1
else if (x <= 3.3d-299) then
tmp = t_2
else if (x <= 1.25d-262) then
tmp = z * -t
else if (x <= 550000000.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 = x + (z * x);
double t_2 = x + (y * t);
double tmp;
if (x <= -1.95e+51) {
tmp = t_1;
} else if (x <= 3.3e-299) {
tmp = t_2;
} else if (x <= 1.25e-262) {
tmp = z * -t;
} else if (x <= 550000000.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (z * x) t_2 = x + (y * t) tmp = 0 if x <= -1.95e+51: tmp = t_1 elif x <= 3.3e-299: tmp = t_2 elif x <= 1.25e-262: tmp = z * -t elif x <= 550000000.0: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(z * x)) t_2 = Float64(x + Float64(y * t)) tmp = 0.0 if (x <= -1.95e+51) tmp = t_1; elseif (x <= 3.3e-299) tmp = t_2; elseif (x <= 1.25e-262) tmp = Float64(z * Float64(-t)); elseif (x <= 550000000.0) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (z * x); t_2 = x + (y * t); tmp = 0.0; if (x <= -1.95e+51) tmp = t_1; elseif (x <= 3.3e-299) tmp = t_2; elseif (x <= 1.25e-262) tmp = z * -t; elseif (x <= 550000000.0) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.95e+51], t$95$1, If[LessEqual[x, 3.3e-299], t$95$2, If[LessEqual[x, 1.25e-262], N[(z * (-t)), $MachinePrecision], If[LessEqual[x, 550000000.0], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + z \cdot x\\
t_2 := x + y \cdot t\\
\mathbf{if}\;x \leq -1.95 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{-299}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-262}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{elif}\;x \leq 550000000:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.94999999999999992e51 or 5.5e8 < x Initial program 100.0%
Taylor expanded in t around 0 86.2%
mul-1-neg86.2%
distribute-rgt-neg-in86.2%
neg-sub086.2%
sub-neg86.2%
+-commutative86.2%
associate--r+86.2%
neg-sub086.2%
remove-double-neg86.2%
Simplified86.2%
Taylor expanded in z around inf 61.5%
if -1.94999999999999992e51 < x < 3.3000000000000002e-299 or 1.24999999999999998e-262 < x < 5.5e8Initial program 100.0%
Taylor expanded in t around inf 80.9%
Taylor expanded in y around inf 61.7%
*-commutative61.7%
Simplified61.7%
if 3.3000000000000002e-299 < x < 1.24999999999999998e-262Initial program 100.0%
Taylor expanded in y around 0 88.1%
mul-1-neg88.1%
unsub-neg88.1%
Simplified88.1%
Taylor expanded in t around inf 88.1%
Taylor expanded in x around 0 88.1%
associate-*r*88.1%
neg-mul-188.1%
*-commutative88.1%
Simplified88.1%
Final simplification62.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* z x))) (t_2 (* x (- 1.0 y))))
(if (<= z -1.75e+79)
t_1
(if (<= z -8.2e-197)
t_2
(if (<= z -2.9e-229) (* y t) (if (<= z 4e+26) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (z * x);
double t_2 = x * (1.0 - y);
double tmp;
if (z <= -1.75e+79) {
tmp = t_1;
} else if (z <= -8.2e-197) {
tmp = t_2;
} else if (z <= -2.9e-229) {
tmp = y * t;
} else if (z <= 4e+26) {
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 = x + (z * x)
t_2 = x * (1.0d0 - y)
if (z <= (-1.75d+79)) then
tmp = t_1
else if (z <= (-8.2d-197)) then
tmp = t_2
else if (z <= (-2.9d-229)) then
tmp = y * t
else if (z <= 4d+26) 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 = x + (z * x);
double t_2 = x * (1.0 - y);
double tmp;
if (z <= -1.75e+79) {
tmp = t_1;
} else if (z <= -8.2e-197) {
tmp = t_2;
} else if (z <= -2.9e-229) {
tmp = y * t;
} else if (z <= 4e+26) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (z * x) t_2 = x * (1.0 - y) tmp = 0 if z <= -1.75e+79: tmp = t_1 elif z <= -8.2e-197: tmp = t_2 elif z <= -2.9e-229: tmp = y * t elif z <= 4e+26: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(z * x)) t_2 = Float64(x * Float64(1.0 - y)) tmp = 0.0 if (z <= -1.75e+79) tmp = t_1; elseif (z <= -8.2e-197) tmp = t_2; elseif (z <= -2.9e-229) tmp = Float64(y * t); elseif (z <= 4e+26) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (z * x); t_2 = x * (1.0 - y); tmp = 0.0; if (z <= -1.75e+79) tmp = t_1; elseif (z <= -8.2e-197) tmp = t_2; elseif (z <= -2.9e-229) tmp = y * t; elseif (z <= 4e+26) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.75e+79], t$95$1, If[LessEqual[z, -8.2e-197], t$95$2, If[LessEqual[z, -2.9e-229], N[(y * t), $MachinePrecision], If[LessEqual[z, 4e+26], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + z \cdot x\\
t_2 := x \cdot \left(1 - y\right)\\
\mathbf{if}\;z \leq -1.75 \cdot 10^{+79}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -8.2 \cdot 10^{-197}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -2.9 \cdot 10^{-229}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+26}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.7499999999999999e79 or 4.00000000000000019e26 < z Initial program 100.0%
Taylor expanded in t around 0 60.9%
mul-1-neg60.9%
distribute-rgt-neg-in60.9%
neg-sub060.9%
sub-neg60.9%
+-commutative60.9%
associate--r+60.9%
neg-sub060.9%
remove-double-neg60.9%
Simplified60.9%
Taylor expanded in z around inf 55.7%
if -1.7499999999999999e79 < z < -8.2e-197 or -2.9e-229 < z < 4.00000000000000019e26Initial program 100.0%
Taylor expanded in y around inf 85.7%
*-commutative85.7%
Simplified85.7%
Taylor expanded in x around inf 59.3%
neg-mul-159.3%
unsub-neg59.3%
Simplified59.3%
if -8.2e-197 < z < -2.9e-229Initial program 100.0%
Taylor expanded in t around inf 100.0%
Taylor expanded in y around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 78.4%
Final simplification58.4%
(FPCore (x y z t)
:precision binary64
(if (<= t -5.8e+174)
(* y t)
(if (<= t 2.15e-43)
(* x (- 1.0 y))
(if (<= t 4e+184) (* y t) (* z (- t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5.8e+174) {
tmp = y * t;
} else if (t <= 2.15e-43) {
tmp = x * (1.0 - y);
} else if (t <= 4e+184) {
tmp = y * t;
} 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 (t <= (-5.8d+174)) then
tmp = y * t
else if (t <= 2.15d-43) then
tmp = x * (1.0d0 - y)
else if (t <= 4d+184) then
tmp = y * t
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 (t <= -5.8e+174) {
tmp = y * t;
} else if (t <= 2.15e-43) {
tmp = x * (1.0 - y);
} else if (t <= 4e+184) {
tmp = y * t;
} else {
tmp = z * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -5.8e+174: tmp = y * t elif t <= 2.15e-43: tmp = x * (1.0 - y) elif t <= 4e+184: tmp = y * t else: tmp = z * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -5.8e+174) tmp = Float64(y * t); elseif (t <= 2.15e-43) tmp = Float64(x * Float64(1.0 - y)); elseif (t <= 4e+184) tmp = Float64(y * t); else tmp = Float64(z * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -5.8e+174) tmp = y * t; elseif (t <= 2.15e-43) tmp = x * (1.0 - y); elseif (t <= 4e+184) tmp = y * t; else tmp = z * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -5.8e+174], N[(y * t), $MachinePrecision], If[LessEqual[t, 2.15e-43], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4e+184], N[(y * t), $MachinePrecision], N[(z * (-t)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.8 \cdot 10^{+174}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;t \leq 2.15 \cdot 10^{-43}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;t \leq 4 \cdot 10^{+184}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\end{array}
\end{array}
if t < -5.7999999999999999e174 or 2.14999999999999982e-43 < t < 4.00000000000000007e184Initial program 100.0%
Taylor expanded in t around inf 81.6%
Taylor expanded in y around inf 55.2%
*-commutative55.2%
Simplified55.2%
Taylor expanded in x around 0 49.7%
if -5.7999999999999999e174 < t < 2.14999999999999982e-43Initial program 100.0%
Taylor expanded in y around inf 60.1%
*-commutative60.1%
Simplified60.1%
Taylor expanded in x around inf 48.2%
neg-mul-148.2%
unsub-neg48.2%
Simplified48.2%
if 4.00000000000000007e184 < t Initial program 99.8%
Taylor expanded in y around 0 76.0%
mul-1-neg76.0%
unsub-neg76.0%
Simplified76.0%
Taylor expanded in t around inf 76.0%
Taylor expanded in x around 0 70.0%
associate-*r*70.0%
neg-mul-170.0%
*-commutative70.0%
Simplified70.0%
Final simplification50.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.35e+24) (not (<= z 3300000000000.0))) (+ x (* z (- x t))) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.35e+24) || !(z <= 3300000000000.0)) {
tmp = x + (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 <= (-1.35d+24)) .or. (.not. (z <= 3300000000000.0d0))) then
tmp = x + (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 <= -1.35e+24) || !(z <= 3300000000000.0)) {
tmp = x + (z * (x - t));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.35e+24) or not (z <= 3300000000000.0): tmp = x + (z * (x - t)) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.35e+24) || !(z <= 3300000000000.0)) tmp = Float64(x + 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 <= -1.35e+24) || ~((z <= 3300000000000.0))) tmp = x + (z * (x - t)); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.35e+24], N[Not[LessEqual[z, 3300000000000.0]], $MachinePrecision]], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+24} \lor \neg \left(z \leq 3300000000000\right):\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -1.35e24 or 3.3e12 < z Initial program 100.0%
Taylor expanded in y around 0 82.4%
mul-1-neg82.4%
unsub-neg82.4%
Simplified82.4%
if -1.35e24 < z < 3.3e12Initial program 100.0%
Taylor expanded in y around inf 90.6%
*-commutative90.6%
Simplified90.6%
Final simplification86.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.85e+95) (not (<= x 7e-24))) (+ x (* x (- z y))) (+ x (* t (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.85e+95) || !(x <= 7e-24)) {
tmp = x + (x * (z - y));
} else {
tmp = x + (t * (y - z));
}
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 <= (-1.85d+95)) .or. (.not. (x <= 7d-24))) then
tmp = x + (x * (z - y))
else
tmp = x + (t * (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.85e+95) || !(x <= 7e-24)) {
tmp = x + (x * (z - y));
} else {
tmp = x + (t * (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.85e+95) or not (x <= 7e-24): tmp = x + (x * (z - y)) else: tmp = x + (t * (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.85e+95) || !(x <= 7e-24)) tmp = Float64(x + Float64(x * Float64(z - y))); else tmp = Float64(x + Float64(t * Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.85e+95) || ~((x <= 7e-24))) tmp = x + (x * (z - y)); else tmp = x + (t * (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.85e+95], N[Not[LessEqual[x, 7e-24]], $MachinePrecision]], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{+95} \lor \neg \left(x \leq 7 \cdot 10^{-24}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \left(y - z\right)\\
\end{array}
\end{array}
if x < -1.8500000000000001e95 or 6.9999999999999993e-24 < x Initial program 100.0%
Taylor expanded in t around 0 86.3%
mul-1-neg86.3%
distribute-rgt-neg-in86.3%
neg-sub086.3%
sub-neg86.3%
+-commutative86.3%
associate--r+86.3%
neg-sub086.3%
remove-double-neg86.3%
Simplified86.3%
if -1.8500000000000001e95 < x < 6.9999999999999993e-24Initial program 100.0%
Taylor expanded in t around inf 85.0%
Final simplification85.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.2e+143) (not (<= x 660000000.0))) (+ x (* z x)) (+ x (* t (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.2e+143) || !(x <= 660000000.0)) {
tmp = x + (z * x);
} else {
tmp = x + (t * (y - z));
}
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 <= (-7.2d+143)) .or. (.not. (x <= 660000000.0d0))) then
tmp = x + (z * x)
else
tmp = x + (t * (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.2e+143) || !(x <= 660000000.0)) {
tmp = x + (z * x);
} else {
tmp = x + (t * (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7.2e+143) or not (x <= 660000000.0): tmp = x + (z * x) else: tmp = x + (t * (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7.2e+143) || !(x <= 660000000.0)) tmp = Float64(x + Float64(z * x)); else tmp = Float64(x + Float64(t * Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -7.2e+143) || ~((x <= 660000000.0))) tmp = x + (z * x); else tmp = x + (t * (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7.2e+143], N[Not[LessEqual[x, 660000000.0]], $MachinePrecision]], N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+143} \lor \neg \left(x \leq 660000000\right):\\
\;\;\;\;x + z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \left(y - z\right)\\
\end{array}
\end{array}
if x < -7.1999999999999998e143 or 6.6e8 < x Initial program 100.0%
Taylor expanded in t around 0 88.6%
mul-1-neg88.6%
distribute-rgt-neg-in88.6%
neg-sub088.6%
sub-neg88.6%
+-commutative88.6%
associate--r+88.6%
neg-sub088.6%
remove-double-neg88.6%
Simplified88.6%
Taylor expanded in z around inf 63.9%
if -7.1999999999999998e143 < x < 6.6e8Initial program 100.0%
Taylor expanded in t around inf 80.0%
Final simplification73.4%
(FPCore (x y z t) :precision binary64 (if (<= y -1.32e-20) (* y t) (if (<= y 750.0) x (* y (- x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.32e-20) {
tmp = y * t;
} else if (y <= 750.0) {
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 <= (-1.32d-20)) then
tmp = y * t
else if (y <= 750.0d0) 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 <= -1.32e-20) {
tmp = y * t;
} else if (y <= 750.0) {
tmp = x;
} else {
tmp = y * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.32e-20: tmp = y * t elif y <= 750.0: tmp = x else: tmp = y * -x return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.32e-20) tmp = Float64(y * t); elseif (y <= 750.0) tmp = x; else tmp = Float64(y * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.32e-20) tmp = y * t; elseif (y <= 750.0) tmp = x; else tmp = y * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.32e-20], N[(y * t), $MachinePrecision], If[LessEqual[y, 750.0], x, N[(y * (-x)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.32 \cdot 10^{-20}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 750:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\end{array}
\end{array}
if y < -1.32000000000000004e-20Initial program 100.0%
Taylor expanded in t around inf 58.9%
Taylor expanded in y around inf 48.3%
*-commutative48.3%
Simplified48.3%
Taylor expanded in x around 0 47.5%
if -1.32000000000000004e-20 < y < 750Initial program 100.0%
Taylor expanded in t around inf 71.1%
Taylor expanded in x around inf 36.6%
if 750 < y Initial program 100.0%
Taylor expanded in y around inf 72.4%
*-commutative72.4%
Simplified72.4%
Taylor expanded in x around inf 41.7%
neg-mul-141.7%
unsub-neg41.7%
Simplified41.7%
Taylor expanded in y around inf 40.5%
mul-1-neg40.5%
distribute-rgt-neg-out40.5%
Simplified40.5%
Final simplification40.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.02e-20) (not (<= y 2.1e-16))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.02e-20) || !(y <= 2.1e-16)) {
tmp = y * 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 ((y <= (-1.02d-20)) .or. (.not. (y <= 2.1d-16))) then
tmp = y * 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 ((y <= -1.02e-20) || !(y <= 2.1e-16)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.02e-20) or not (y <= 2.1e-16): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.02e-20) || !(y <= 2.1e-16)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.02e-20) || ~((y <= 2.1e-16))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.02e-20], N[Not[LessEqual[y, 2.1e-16]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.02 \cdot 10^{-20} \lor \neg \left(y \leq 2.1 \cdot 10^{-16}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.02000000000000001e-20 or 2.1000000000000001e-16 < y Initial program 100.0%
Taylor expanded in t around inf 54.1%
Taylor expanded in y around inf 41.9%
*-commutative41.9%
Simplified41.9%
Taylor expanded in x around 0 41.1%
if -1.02000000000000001e-20 < y < 2.1000000000000001e-16Initial program 100.0%
Taylor expanded in t around inf 70.6%
Taylor expanded in x around inf 38.1%
Final simplification39.7%
(FPCore (x y z t) :precision binary64 (+ x (* (- z y) (- x t))))
double code(double x, double y, double z, double t) {
return x + ((z - y) * (x - t));
}
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 + ((z - y) * (x - t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z - y) * (x - t));
}
def code(x, y, z, t): return x + ((z - y) * (x - t))
function code(x, y, z, t) return Float64(x + Float64(Float64(z - y) * Float64(x - t))) end
function tmp = code(x, y, z, t) tmp = x + ((z - y) * (x - t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z - y), $MachinePrecision] * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - y\right) \cdot \left(x - t\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 61.7%
Taylor expanded in x around inf 19.5%
(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 2024106
(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))))