
(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 12 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-def100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))) (t_2 (+ x (* z x))))
(if (<= z -7.8e+267)
t_1
(if (<= z -5.6e+236)
t_2
(if (<= z -9.4e+204)
t_1
(if (<= z -1.3e+28)
t_2
(if (<= z -2.7e-122)
(- x (* y x))
(if (<= z 9.5e+67) (+ x (* y t)) t_1))))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double t_2 = x + (z * x);
double tmp;
if (z <= -7.8e+267) {
tmp = t_1;
} else if (z <= -5.6e+236) {
tmp = t_2;
} else if (z <= -9.4e+204) {
tmp = t_1;
} else if (z <= -1.3e+28) {
tmp = t_2;
} else if (z <= -2.7e-122) {
tmp = x - (y * x);
} else if (z <= 9.5e+67) {
tmp = x + (y * t);
} 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 * -t
t_2 = x + (z * x)
if (z <= (-7.8d+267)) then
tmp = t_1
else if (z <= (-5.6d+236)) then
tmp = t_2
else if (z <= (-9.4d+204)) then
tmp = t_1
else if (z <= (-1.3d+28)) then
tmp = t_2
else if (z <= (-2.7d-122)) then
tmp = x - (y * x)
else if (z <= 9.5d+67) then
tmp = x + (y * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double t_2 = x + (z * x);
double tmp;
if (z <= -7.8e+267) {
tmp = t_1;
} else if (z <= -5.6e+236) {
tmp = t_2;
} else if (z <= -9.4e+204) {
tmp = t_1;
} else if (z <= -1.3e+28) {
tmp = t_2;
} else if (z <= -2.7e-122) {
tmp = x - (y * x);
} else if (z <= 9.5e+67) {
tmp = x + (y * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t t_2 = x + (z * x) tmp = 0 if z <= -7.8e+267: tmp = t_1 elif z <= -5.6e+236: tmp = t_2 elif z <= -9.4e+204: tmp = t_1 elif z <= -1.3e+28: tmp = t_2 elif z <= -2.7e-122: tmp = x - (y * x) elif z <= 9.5e+67: tmp = x + (y * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) t_2 = Float64(x + Float64(z * x)) tmp = 0.0 if (z <= -7.8e+267) tmp = t_1; elseif (z <= -5.6e+236) tmp = t_2; elseif (z <= -9.4e+204) tmp = t_1; elseif (z <= -1.3e+28) tmp = t_2; elseif (z <= -2.7e-122) tmp = Float64(x - Float64(y * x)); elseif (z <= 9.5e+67) tmp = Float64(x + Float64(y * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; t_2 = x + (z * x); tmp = 0.0; if (z <= -7.8e+267) tmp = t_1; elseif (z <= -5.6e+236) tmp = t_2; elseif (z <= -9.4e+204) tmp = t_1; elseif (z <= -1.3e+28) tmp = t_2; elseif (z <= -2.7e-122) tmp = x - (y * x); elseif (z <= 9.5e+67) tmp = x + (y * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.8e+267], t$95$1, If[LessEqual[z, -5.6e+236], t$95$2, If[LessEqual[z, -9.4e+204], t$95$1, If[LessEqual[z, -1.3e+28], t$95$2, If[LessEqual[z, -2.7e-122], N[(x - N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.5e+67], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
t_2 := x + z \cdot x\\
\mathbf{if}\;z \leq -7.8 \cdot 10^{+267}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -5.6 \cdot 10^{+236}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -9.4 \cdot 10^{+204}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.3 \cdot 10^{+28}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -2.7 \cdot 10^{-122}:\\
\;\;\;\;x - y \cdot x\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+67}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -7.79999999999999961e267 or -5.59999999999999985e236 < z < -9.4000000000000003e204 or 9.5000000000000002e67 < z Initial program 100.0%
Taylor expanded in t around inf 66.5%
Taylor expanded in y around 0 60.3%
associate-*r*60.3%
neg-mul-160.3%
Simplified60.3%
Taylor expanded in x around 0 59.5%
associate-*r*59.5%
mul-1-neg59.5%
Simplified59.5%
if -7.79999999999999961e267 < z < -5.59999999999999985e236 or -9.4000000000000003e204 < z < -1.3000000000000001e28Initial program 99.9%
Taylor expanded in y around 0 73.4%
mul-1-neg73.4%
distribute-rgt-neg-out73.4%
fma-def73.4%
Simplified73.4%
Taylor expanded in t around 0 56.9%
if -1.3000000000000001e28 < z < -2.70000000000000009e-122Initial program 100.0%
Taylor expanded in x around inf 75.5%
*-commutative75.5%
mul-1-neg75.5%
unsub-neg75.5%
distribute-lft-out--75.6%
*-rgt-identity75.6%
Simplified75.6%
Taylor expanded in y around inf 70.8%
if -2.70000000000000009e-122 < z < 9.5000000000000002e67Initial program 100.0%
Taylor expanded in t around inf 82.4%
Taylor expanded in z around 0 73.7%
Final simplification66.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))) (t_2 (+ x (* z x))))
(if (<= z -6.8e+267)
t_1
(if (<= z -4.1e+237)
t_2
(if (<= z -4.5e+205)
t_1
(if (<= z -1.06e+28)
t_2
(if (<= z -2.75e-122)
(- x (* y x))
(if (<= z 9.5e+65) (+ x (* y t)) (- x (* z t))))))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double t_2 = x + (z * x);
double tmp;
if (z <= -6.8e+267) {
tmp = t_1;
} else if (z <= -4.1e+237) {
tmp = t_2;
} else if (z <= -4.5e+205) {
tmp = t_1;
} else if (z <= -1.06e+28) {
tmp = t_2;
} else if (z <= -2.75e-122) {
tmp = x - (y * x);
} else if (z <= 9.5e+65) {
tmp = x + (y * t);
} else {
tmp = x - (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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = z * -t
t_2 = x + (z * x)
if (z <= (-6.8d+267)) then
tmp = t_1
else if (z <= (-4.1d+237)) then
tmp = t_2
else if (z <= (-4.5d+205)) then
tmp = t_1
else if (z <= (-1.06d+28)) then
tmp = t_2
else if (z <= (-2.75d-122)) then
tmp = x - (y * x)
else if (z <= 9.5d+65) then
tmp = x + (y * t)
else
tmp = x - (z * t)
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 = x + (z * x);
double tmp;
if (z <= -6.8e+267) {
tmp = t_1;
} else if (z <= -4.1e+237) {
tmp = t_2;
} else if (z <= -4.5e+205) {
tmp = t_1;
} else if (z <= -1.06e+28) {
tmp = t_2;
} else if (z <= -2.75e-122) {
tmp = x - (y * x);
} else if (z <= 9.5e+65) {
tmp = x + (y * t);
} else {
tmp = x - (z * t);
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t t_2 = x + (z * x) tmp = 0 if z <= -6.8e+267: tmp = t_1 elif z <= -4.1e+237: tmp = t_2 elif z <= -4.5e+205: tmp = t_1 elif z <= -1.06e+28: tmp = t_2 elif z <= -2.75e-122: tmp = x - (y * x) elif z <= 9.5e+65: tmp = x + (y * t) else: tmp = x - (z * t) return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) t_2 = Float64(x + Float64(z * x)) tmp = 0.0 if (z <= -6.8e+267) tmp = t_1; elseif (z <= -4.1e+237) tmp = t_2; elseif (z <= -4.5e+205) tmp = t_1; elseif (z <= -1.06e+28) tmp = t_2; elseif (z <= -2.75e-122) tmp = Float64(x - Float64(y * x)); elseif (z <= 9.5e+65) tmp = Float64(x + Float64(y * t)); else tmp = Float64(x - Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; t_2 = x + (z * x); tmp = 0.0; if (z <= -6.8e+267) tmp = t_1; elseif (z <= -4.1e+237) tmp = t_2; elseif (z <= -4.5e+205) tmp = t_1; elseif (z <= -1.06e+28) tmp = t_2; elseif (z <= -2.75e-122) tmp = x - (y * x); elseif (z <= 9.5e+65) tmp = x + (y * t); else tmp = x - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.8e+267], t$95$1, If[LessEqual[z, -4.1e+237], t$95$2, If[LessEqual[z, -4.5e+205], t$95$1, If[LessEqual[z, -1.06e+28], t$95$2, If[LessEqual[z, -2.75e-122], N[(x - N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.5e+65], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
t_2 := x + z \cdot x\\
\mathbf{if}\;z \leq -6.8 \cdot 10^{+267}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -4.1 \cdot 10^{+237}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -4.5 \cdot 10^{+205}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.06 \cdot 10^{+28}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -2.75 \cdot 10^{-122}:\\
\;\;\;\;x - y \cdot x\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+65}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot t\\
\end{array}
\end{array}
if z < -6.79999999999999964e267 or -4.10000000000000003e237 < z < -4.50000000000000035e205Initial program 100.0%
Taylor expanded in t around inf 86.2%
Taylor expanded in y around 0 82.3%
associate-*r*82.3%
neg-mul-182.3%
Simplified82.3%
Taylor expanded in x around 0 82.3%
associate-*r*82.3%
mul-1-neg82.3%
Simplified82.3%
if -6.79999999999999964e267 < z < -4.10000000000000003e237 or -4.50000000000000035e205 < z < -1.0600000000000001e28Initial program 99.9%
Taylor expanded in y around 0 73.4%
mul-1-neg73.4%
distribute-rgt-neg-out73.4%
fma-def73.4%
Simplified73.4%
Taylor expanded in t around 0 56.9%
if -1.0600000000000001e28 < z < -2.75000000000000026e-122Initial program 100.0%
Taylor expanded in x around inf 75.5%
*-commutative75.5%
mul-1-neg75.5%
unsub-neg75.5%
distribute-lft-out--75.6%
*-rgt-identity75.6%
Simplified75.6%
Taylor expanded in y around inf 70.8%
if -2.75000000000000026e-122 < z < 9.5000000000000005e65Initial program 100.0%
Taylor expanded in t around inf 83.1%
Taylor expanded in z around 0 74.2%
if 9.5000000000000005e65 < z Initial program 100.0%
Taylor expanded in t around inf 54.3%
Taylor expanded in y around 0 46.9%
associate-*r*46.9%
neg-mul-146.9%
Simplified46.9%
add-sqr-sqrt19.5%
fma-def19.5%
distribute-lft-neg-out19.5%
add-sqr-sqrt2.9%
sqrt-unprod3.5%
sqr-neg3.5%
sqrt-unprod0.6%
add-sqr-sqrt1.4%
fma-neg1.4%
add-sqr-sqrt4.5%
*-commutative4.5%
add-sqr-sqrt3.4%
sqrt-unprod16.9%
sqr-neg16.9%
sqrt-unprod13.5%
add-sqr-sqrt46.9%
Applied egg-rr46.9%
Final simplification67.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* z x))) (t_2 (- x (* y x))) (t_3 (+ x (* (- y z) t))))
(if (<= t -6.5e-122)
t_3
(if (<= t -3.6e-205)
t_1
(if (<= t 2.6e-168)
t_2
(if (<= t 1.5e-76) t_1 (if (<= t 2.8e-62) t_2 t_3)))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (z * x);
double t_2 = x - (y * x);
double t_3 = x + ((y - z) * t);
double tmp;
if (t <= -6.5e-122) {
tmp = t_3;
} else if (t <= -3.6e-205) {
tmp = t_1;
} else if (t <= 2.6e-168) {
tmp = t_2;
} else if (t <= 1.5e-76) {
tmp = t_1;
} else if (t <= 2.8e-62) {
tmp = t_2;
} else {
tmp = t_3;
}
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 + (z * x)
t_2 = x - (y * x)
t_3 = x + ((y - z) * t)
if (t <= (-6.5d-122)) then
tmp = t_3
else if (t <= (-3.6d-205)) then
tmp = t_1
else if (t <= 2.6d-168) then
tmp = t_2
else if (t <= 1.5d-76) then
tmp = t_1
else if (t <= 2.8d-62) then
tmp = t_2
else
tmp = t_3
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 * x);
double t_3 = x + ((y - z) * t);
double tmp;
if (t <= -6.5e-122) {
tmp = t_3;
} else if (t <= -3.6e-205) {
tmp = t_1;
} else if (t <= 2.6e-168) {
tmp = t_2;
} else if (t <= 1.5e-76) {
tmp = t_1;
} else if (t <= 2.8e-62) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (z * x) t_2 = x - (y * x) t_3 = x + ((y - z) * t) tmp = 0 if t <= -6.5e-122: tmp = t_3 elif t <= -3.6e-205: tmp = t_1 elif t <= 2.6e-168: tmp = t_2 elif t <= 1.5e-76: tmp = t_1 elif t <= 2.8e-62: tmp = t_2 else: tmp = t_3 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(z * x)) t_2 = Float64(x - Float64(y * x)) t_3 = Float64(x + Float64(Float64(y - z) * t)) tmp = 0.0 if (t <= -6.5e-122) tmp = t_3; elseif (t <= -3.6e-205) tmp = t_1; elseif (t <= 2.6e-168) tmp = t_2; elseif (t <= 1.5e-76) tmp = t_1; elseif (t <= 2.8e-62) tmp = t_2; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (z * x); t_2 = x - (y * x); t_3 = x + ((y - z) * t); tmp = 0.0; if (t <= -6.5e-122) tmp = t_3; elseif (t <= -3.6e-205) tmp = t_1; elseif (t <= 2.6e-168) tmp = t_2; elseif (t <= 1.5e-76) tmp = t_1; elseif (t <= 2.8e-62) tmp = t_2; else tmp = t_3; 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 * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -6.5e-122], t$95$3, If[LessEqual[t, -3.6e-205], t$95$1, If[LessEqual[t, 2.6e-168], t$95$2, If[LessEqual[t, 1.5e-76], t$95$1, If[LessEqual[t, 2.8e-62], t$95$2, t$95$3]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + z \cdot x\\
t_2 := x - y \cdot x\\
t_3 := x + \left(y - z\right) \cdot t\\
\mathbf{if}\;t \leq -6.5 \cdot 10^{-122}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t \leq -3.6 \cdot 10^{-205}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 2.6 \cdot 10^{-168}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 1.5 \cdot 10^{-76}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{-62}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if t < -6.49999999999999965e-122 or 2.80000000000000002e-62 < t Initial program 100.0%
Taylor expanded in t around inf 83.4%
if -6.49999999999999965e-122 < t < -3.5999999999999998e-205 or 2.6000000000000001e-168 < t < 1.50000000000000012e-76Initial program 100.0%
Taylor expanded in y around 0 73.1%
mul-1-neg73.1%
distribute-rgt-neg-out73.1%
fma-def73.1%
Simplified73.1%
Taylor expanded in t around 0 69.4%
if -3.5999999999999998e-205 < t < 2.6000000000000001e-168 or 1.50000000000000012e-76 < t < 2.80000000000000002e-62Initial program 100.0%
Taylor expanded in x around inf 94.5%
*-commutative94.5%
mul-1-neg94.5%
unsub-neg94.5%
distribute-lft-out--94.5%
*-rgt-identity94.5%
Simplified94.5%
Taylor expanded in y around inf 81.7%
Final simplification80.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))) (t_2 (+ x (* z x))))
(if (<= z -6.8e+267)
t_1
(if (<= z -6e+236)
t_2
(if (<= z -6.4e+205)
t_1
(if (<= z -4.5e+18) t_2 (if (<= z 1.25e+68) (+ x (* y t)) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double t_2 = x + (z * x);
double tmp;
if (z <= -6.8e+267) {
tmp = t_1;
} else if (z <= -6e+236) {
tmp = t_2;
} else if (z <= -6.4e+205) {
tmp = t_1;
} else if (z <= -4.5e+18) {
tmp = t_2;
} else if (z <= 1.25e+68) {
tmp = x + (y * t);
} 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 * -t
t_2 = x + (z * x)
if (z <= (-6.8d+267)) then
tmp = t_1
else if (z <= (-6d+236)) then
tmp = t_2
else if (z <= (-6.4d+205)) then
tmp = t_1
else if (z <= (-4.5d+18)) then
tmp = t_2
else if (z <= 1.25d+68) then
tmp = x + (y * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double t_2 = x + (z * x);
double tmp;
if (z <= -6.8e+267) {
tmp = t_1;
} else if (z <= -6e+236) {
tmp = t_2;
} else if (z <= -6.4e+205) {
tmp = t_1;
} else if (z <= -4.5e+18) {
tmp = t_2;
} else if (z <= 1.25e+68) {
tmp = x + (y * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t t_2 = x + (z * x) tmp = 0 if z <= -6.8e+267: tmp = t_1 elif z <= -6e+236: tmp = t_2 elif z <= -6.4e+205: tmp = t_1 elif z <= -4.5e+18: tmp = t_2 elif z <= 1.25e+68: tmp = x + (y * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) t_2 = Float64(x + Float64(z * x)) tmp = 0.0 if (z <= -6.8e+267) tmp = t_1; elseif (z <= -6e+236) tmp = t_2; elseif (z <= -6.4e+205) tmp = t_1; elseif (z <= -4.5e+18) tmp = t_2; elseif (z <= 1.25e+68) tmp = Float64(x + Float64(y * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; t_2 = x + (z * x); tmp = 0.0; if (z <= -6.8e+267) tmp = t_1; elseif (z <= -6e+236) tmp = t_2; elseif (z <= -6.4e+205) tmp = t_1; elseif (z <= -4.5e+18) tmp = t_2; elseif (z <= 1.25e+68) tmp = x + (y * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.8e+267], t$95$1, If[LessEqual[z, -6e+236], t$95$2, If[LessEqual[z, -6.4e+205], t$95$1, If[LessEqual[z, -4.5e+18], t$95$2, If[LessEqual[z, 1.25e+68], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
t_2 := x + z \cdot x\\
\mathbf{if}\;z \leq -6.8 \cdot 10^{+267}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -6 \cdot 10^{+236}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -6.4 \cdot 10^{+205}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -4.5 \cdot 10^{+18}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+68}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -6.79999999999999964e267 or -5.9999999999999996e236 < z < -6.39999999999999993e205 or 1.2500000000000001e68 < z Initial program 100.0%
Taylor expanded in t around inf 66.5%
Taylor expanded in y around 0 60.3%
associate-*r*60.3%
neg-mul-160.3%
Simplified60.3%
Taylor expanded in x around 0 59.5%
associate-*r*59.5%
mul-1-neg59.5%
Simplified59.5%
if -6.79999999999999964e267 < z < -5.9999999999999996e236 or -6.39999999999999993e205 < z < -4.5e18Initial program 99.9%
Taylor expanded in y around 0 72.2%
mul-1-neg72.2%
distribute-rgt-neg-out72.2%
fma-def72.2%
Simplified72.2%
Taylor expanded in t around 0 56.6%
if -4.5e18 < z < 1.2500000000000001e68Initial program 100.0%
Taylor expanded in t around inf 77.9%
Taylor expanded in z around 0 68.0%
Final simplification63.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= z -8e-17)
t_1
(if (<= z -6e-156)
x
(if (<= z 2.9e-61)
(* y t)
(if (<= z 1.52e-18) x (if (<= z 5.5e+66) (* y t) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -8e-17) {
tmp = t_1;
} else if (z <= -6e-156) {
tmp = x;
} else if (z <= 2.9e-61) {
tmp = y * t;
} else if (z <= 1.52e-18) {
tmp = x;
} else if (z <= 5.5e+66) {
tmp = y * t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = z * -t
if (z <= (-8d-17)) then
tmp = t_1
else if (z <= (-6d-156)) then
tmp = x
else if (z <= 2.9d-61) then
tmp = y * t
else if (z <= 1.52d-18) then
tmp = x
else if (z <= 5.5d+66) then
tmp = y * t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -8e-17) {
tmp = t_1;
} else if (z <= -6e-156) {
tmp = x;
} else if (z <= 2.9e-61) {
tmp = y * t;
} else if (z <= 1.52e-18) {
tmp = x;
} else if (z <= 5.5e+66) {
tmp = y * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -8e-17: tmp = t_1 elif z <= -6e-156: tmp = x elif z <= 2.9e-61: tmp = y * t elif z <= 1.52e-18: tmp = x elif z <= 5.5e+66: tmp = y * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -8e-17) tmp = t_1; elseif (z <= -6e-156) tmp = x; elseif (z <= 2.9e-61) tmp = Float64(y * t); elseif (z <= 1.52e-18) tmp = x; elseif (z <= 5.5e+66) tmp = Float64(y * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; tmp = 0.0; if (z <= -8e-17) tmp = t_1; elseif (z <= -6e-156) tmp = x; elseif (z <= 2.9e-61) tmp = y * t; elseif (z <= 1.52e-18) tmp = x; elseif (z <= 5.5e+66) tmp = y * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[z, -8e-17], t$95$1, If[LessEqual[z, -6e-156], x, If[LessEqual[z, 2.9e-61], N[(y * t), $MachinePrecision], If[LessEqual[z, 1.52e-18], x, If[LessEqual[z, 5.5e+66], N[(y * t), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -8 \cdot 10^{-17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -6 \cdot 10^{-156}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{-61}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 1.52 \cdot 10^{-18}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{+66}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -8.00000000000000057e-17 or 5.5e66 < z Initial program 100.0%
Taylor expanded in t around inf 53.7%
Taylor expanded in y around 0 44.9%
associate-*r*44.9%
neg-mul-144.9%
Simplified44.9%
Taylor expanded in x around 0 44.0%
associate-*r*44.0%
mul-1-neg44.0%
Simplified44.0%
if -8.00000000000000057e-17 < z < -6e-156 or 2.8999999999999999e-61 < z < 1.52e-18Initial program 100.0%
Taylor expanded in t around inf 78.8%
Taylor expanded in x around inf 46.4%
if -6e-156 < z < 2.8999999999999999e-61 or 1.52e-18 < z < 5.5e66Initial program 100.0%
Taylor expanded in t around inf 81.1%
Taylor expanded in z around 0 74.5%
Taylor expanded in y around inf 47.9%
Final simplification45.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.8e+67) (not (<= y 2.15e+68))) (+ x (* y (- t x))) (+ x (* (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.8e+67) || !(y <= 2.15e+68)) {
tmp = x + (y * (t - x));
} else {
tmp = x + ((y - 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 <= (-6.8d+67)) .or. (.not. (y <= 2.15d+68))) then
tmp = x + (y * (t - x))
else
tmp = x + ((y - z) * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.8e+67) || !(y <= 2.15e+68)) {
tmp = x + (y * (t - x));
} else {
tmp = x + ((y - z) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6.8e+67) or not (y <= 2.15e+68): tmp = x + (y * (t - x)) else: tmp = x + ((y - z) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6.8e+67) || !(y <= 2.15e+68)) tmp = Float64(x + Float64(y * Float64(t - x))); else tmp = Float64(x + Float64(Float64(y - z) * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -6.8e+67) || ~((y <= 2.15e+68))) tmp = x + (y * (t - x)); else tmp = x + ((y - z) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.8e+67], N[Not[LessEqual[y, 2.15e+68]], $MachinePrecision]], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{+67} \lor \neg \left(y \leq 2.15 \cdot 10^{+68}\right):\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\end{array}
\end{array}
if y < -6.8000000000000003e67 or 2.1500000000000001e68 < y Initial program 100.0%
Taylor expanded in z around 0 81.4%
if -6.8000000000000003e67 < y < 2.1500000000000001e68Initial program 100.0%
Taylor expanded in t around inf 75.7%
Final simplification78.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.3e-96) (not (<= t 6.5e+29))) (+ x (* (- y z) t)) (- x (* (- y z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.3e-96) || !(t <= 6.5e+29)) {
tmp = x + ((y - z) * t);
} else {
tmp = x - ((y - 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 ((t <= (-5.3d-96)) .or. (.not. (t <= 6.5d+29))) then
tmp = x + ((y - z) * t)
else
tmp = x - ((y - z) * x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.3e-96) || !(t <= 6.5e+29)) {
tmp = x + ((y - z) * t);
} else {
tmp = x - ((y - z) * x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.3e-96) or not (t <= 6.5e+29): tmp = x + ((y - z) * t) else: tmp = x - ((y - z) * x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.3e-96) || !(t <= 6.5e+29)) tmp = Float64(x + Float64(Float64(y - z) * t)); else tmp = Float64(x - Float64(Float64(y - z) * x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5.3e-96) || ~((t <= 6.5e+29))) tmp = x + ((y - z) * t); else tmp = x - ((y - z) * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.3e-96], N[Not[LessEqual[t, 6.5e+29]], $MachinePrecision]], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.3 \cdot 10^{-96} \lor \neg \left(t \leq 6.5 \cdot 10^{+29}\right):\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x - \left(y - z\right) \cdot x\\
\end{array}
\end{array}
if t < -5.3000000000000001e-96 or 6.49999999999999971e29 < t Initial program 100.0%
Taylor expanded in t around inf 88.1%
if -5.3000000000000001e-96 < t < 6.49999999999999971e29Initial program 100.0%
Taylor expanded in x around inf 87.9%
*-commutative87.9%
mul-1-neg87.9%
unsub-neg87.9%
distribute-lft-out--87.9%
*-rgt-identity87.9%
Simplified87.9%
Final simplification88.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.35e+172) (not (<= z 3.7e+70))) (* z (- t)) (+ x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.35e+172) || !(z <= 3.7e+70)) {
tmp = z * -t;
} else {
tmp = x + (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 ((z <= (-1.35d+172)) .or. (.not. (z <= 3.7d+70))) then
tmp = z * -t
else
tmp = x + (y * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.35e+172) || !(z <= 3.7e+70)) {
tmp = z * -t;
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.35e+172) or not (z <= 3.7e+70): tmp = z * -t else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.35e+172) || !(z <= 3.7e+70)) tmp = Float64(z * Float64(-t)); else tmp = Float64(x + Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.35e+172) || ~((z <= 3.7e+70))) tmp = z * -t; else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.35e+172], N[Not[LessEqual[z, 3.7e+70]], $MachinePrecision]], N[(z * (-t)), $MachinePrecision], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+172} \lor \neg \left(z \leq 3.7 \cdot 10^{+70}\right):\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if z < -1.35e172 or 3.69999999999999989e70 < z Initial program 100.0%
Taylor expanded in t around inf 61.0%
Taylor expanded in y around 0 55.4%
associate-*r*55.4%
neg-mul-155.4%
Simplified55.4%
Taylor expanded in x around 0 54.8%
associate-*r*54.8%
mul-1-neg54.8%
Simplified54.8%
if -1.35e172 < z < 3.69999999999999989e70Initial program 100.0%
Taylor expanded in t around inf 70.9%
Taylor expanded in z around 0 60.8%
Final simplification58.8%
(FPCore (x y z t) :precision binary64 (- x (* (- y z) (- x t))))
double code(double x, double y, double z, double t) {
return x - ((y - z) * (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 - ((y - z) * (x - t))
end function
public static double code(double x, double y, double z, double t) {
return x - ((y - z) * (x - t));
}
def code(x, y, z, t): return x - ((y - z) * (x - t))
function code(x, y, z, t) return Float64(x - Float64(Float64(y - z) * Float64(x - t))) end
function tmp = code(x, y, z, t) tmp = x - ((y - z) * (x - t)); end
code[x_, y_, z_, t_] := N[(x - N[(N[(y - z), $MachinePrecision] * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(y - z\right) \cdot \left(x - t\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (if (<= y -1.4e-18) (* y t) (if (<= y 7.4e-39) x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.4e-18) {
tmp = y * t;
} else if (y <= 7.4e-39) {
tmp = 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.4d-18)) then
tmp = y * t
else if (y <= 7.4d-39) then
tmp = 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.4e-18) {
tmp = y * t;
} else if (y <= 7.4e-39) {
tmp = x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.4e-18: tmp = y * t elif y <= 7.4e-39: tmp = x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.4e-18) tmp = Float64(y * t); elseif (y <= 7.4e-39) tmp = x; else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.4e-18) tmp = y * t; elseif (y <= 7.4e-39) tmp = x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.4e-18], N[(y * t), $MachinePrecision], If[LessEqual[y, 7.4e-39], x, N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{-18}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 7.4 \cdot 10^{-39}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -1.40000000000000006e-18 or 7.40000000000000029e-39 < y Initial program 100.0%
Taylor expanded in t around inf 60.3%
Taylor expanded in z around 0 42.6%
Taylor expanded in y around inf 41.8%
if -1.40000000000000006e-18 < y < 7.40000000000000029e-39Initial program 99.9%
Taylor expanded in t around inf 76.3%
Taylor expanded in x around inf 37.9%
Final simplification40.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 67.6%
Taylor expanded in x around inf 18.9%
Final simplification18.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 2023252
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:herbie-target
(+ x (+ (* t (- y z)) (* (- x) (- y z))))
(+ x (* (- y z) (- t x))))