
(FPCore (x y z t) :precision binary64 (* (- (* x y) (* z y)) t))
double code(double x, double y, double z, double t) {
return ((x * y) - (z * y)) * 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 * y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x * y) - (z * y)) * t;
}
def code(x, y, z, t): return ((x * y) - (z * y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x * y) - Float64(z * y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x * y) - (z * y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y - z \cdot y\right) \cdot t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (- (* x y) (* z y)) t))
double code(double x, double y, double z, double t) {
return ((x * y) - (z * y)) * 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 * y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x * y) - (z * y)) * t;
}
def code(x, y, z, t): return ((x * y) - (z * y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x * y) - Float64(z * y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x * y) - (z * y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y - z \cdot y\right) \cdot t
\end{array}
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -1e+36) (* y (* (- x z) t)) (* t (* y (- x z)))))
assert(y < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1e+36) {
tmp = y * ((x - z) * t);
} else {
tmp = t * (y * (x - z));
}
return tmp;
}
NOTE: y and t should be sorted in increasing order before calling this function.
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 <= (-1d+36)) then
tmp = y * ((x - z) * t)
else
tmp = t * (y * (x - z))
end if
code = tmp
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1e+36) {
tmp = y * ((x - z) * t);
} else {
tmp = t * (y * (x - z));
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): tmp = 0 if y <= -1e+36: tmp = y * ((x - z) * t) else: tmp = t * (y * (x - z)) return tmp
y, t = sort([y, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -1e+36) tmp = Float64(y * Float64(Float64(x - z) * t)); else tmp = Float64(t * Float64(y * Float64(x - z))); end return tmp end
y, t = num2cell(sort([y, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -1e+36)
tmp = y * ((x - z) * t);
else
tmp = t * (y * (x - z));
end
tmp_2 = tmp;
end
NOTE: y and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -1e+36], N[(y * N[(N[(x - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(t * N[(y * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+36}:\\
\;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\
\end{array}
\end{array}
if y < -1.00000000000000004e36Initial program 81.3%
distribute-rgt-out--89.8%
associate-*l*99.8%
Simplified99.8%
if -1.00000000000000004e36 < y Initial program 93.3%
distribute-rgt-out--94.3%
Simplified94.3%
Final simplification95.3%
NOTE: y and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (* y x))) (t_2 (* z (* t (- y)))))
(if (<= x -6.4e+62)
t_1
(if (<= x 1.2e+37)
t_2
(if (<= x 8e+104) t_1 (if (<= x 4.3e+128) t_2 (* y (* x t))))))))assert(y < t);
double code(double x, double y, double z, double t) {
double t_1 = t * (y * x);
double t_2 = z * (t * -y);
double tmp;
if (x <= -6.4e+62) {
tmp = t_1;
} else if (x <= 1.2e+37) {
tmp = t_2;
} else if (x <= 8e+104) {
tmp = t_1;
} else if (x <= 4.3e+128) {
tmp = t_2;
} else {
tmp = y * (x * t);
}
return tmp;
}
NOTE: y and t should be sorted in increasing order before calling this function.
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 = t * (y * x)
t_2 = z * (t * -y)
if (x <= (-6.4d+62)) then
tmp = t_1
else if (x <= 1.2d+37) then
tmp = t_2
else if (x <= 8d+104) then
tmp = t_1
else if (x <= 4.3d+128) then
tmp = t_2
else
tmp = y * (x * t)
end if
code = tmp
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
double t_1 = t * (y * x);
double t_2 = z * (t * -y);
double tmp;
if (x <= -6.4e+62) {
tmp = t_1;
} else if (x <= 1.2e+37) {
tmp = t_2;
} else if (x <= 8e+104) {
tmp = t_1;
} else if (x <= 4.3e+128) {
tmp = t_2;
} else {
tmp = y * (x * t);
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): t_1 = t * (y * x) t_2 = z * (t * -y) tmp = 0 if x <= -6.4e+62: tmp = t_1 elif x <= 1.2e+37: tmp = t_2 elif x <= 8e+104: tmp = t_1 elif x <= 4.3e+128: tmp = t_2 else: tmp = y * (x * t) return tmp
y, t = sort([y, t]) function code(x, y, z, t) t_1 = Float64(t * Float64(y * x)) t_2 = Float64(z * Float64(t * Float64(-y))) tmp = 0.0 if (x <= -6.4e+62) tmp = t_1; elseif (x <= 1.2e+37) tmp = t_2; elseif (x <= 8e+104) tmp = t_1; elseif (x <= 4.3e+128) tmp = t_2; else tmp = Float64(y * Float64(x * t)); end return tmp end
y, t = num2cell(sort([y, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = t * (y * x);
t_2 = z * (t * -y);
tmp = 0.0;
if (x <= -6.4e+62)
tmp = t_1;
elseif (x <= 1.2e+37)
tmp = t_2;
elseif (x <= 8e+104)
tmp = t_1;
elseif (x <= 4.3e+128)
tmp = t_2;
else
tmp = y * (x * t);
end
tmp_2 = tmp;
end
NOTE: y and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(y * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(t * (-y)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.4e+62], t$95$1, If[LessEqual[x, 1.2e+37], t$95$2, If[LessEqual[x, 8e+104], t$95$1, If[LessEqual[x, 4.3e+128], t$95$2, N[(y * N[(x * t), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
\begin{array}{l}
t_1 := t \cdot \left(y \cdot x\right)\\
t_2 := z \cdot \left(t \cdot \left(-y\right)\right)\\
\mathbf{if}\;x \leq -6.4 \cdot 10^{+62}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+37}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+104}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.3 \cdot 10^{+128}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot t\right)\\
\end{array}
\end{array}
if x < -6.39999999999999968e62 or 1.2e37 < x < 8e104Initial program 87.6%
distribute-rgt-out--92.6%
Simplified92.6%
Taylor expanded in x around inf 81.7%
if -6.39999999999999968e62 < x < 1.2e37 or 8e104 < x < 4.29999999999999975e128Initial program 95.8%
distribute-rgt-out--95.8%
associate-*l*93.8%
Simplified93.8%
Taylor expanded in x around 0 76.4%
associate-*r*76.4%
neg-mul-176.4%
Simplified76.4%
distribute-lft-neg-out76.4%
add-sqr-sqrt41.0%
sqrt-unprod41.7%
sqr-neg41.7%
sqrt-unprod7.4%
add-sqr-sqrt13.0%
associate-*r*13.8%
*-commutative13.8%
*-commutative13.8%
add-sqr-sqrt8.1%
sqrt-unprod40.3%
sqr-neg40.3%
sqrt-unprod40.8%
add-sqr-sqrt76.3%
Applied egg-rr76.3%
if 4.29999999999999975e128 < x Initial program 78.0%
distribute-rgt-out--84.7%
associate-*l*84.9%
Simplified84.9%
Taylor expanded in x around inf 72.7%
Final simplification77.5%
NOTE: y and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (* y x))))
(if (<= x -1.35e+63)
t_1
(if (<= x 5.2e+37)
(* y (* t (- z)))
(if (<= x 3.2e+104)
t_1
(if (<= x 4.9e+134) (* z (* t (- y))) (* y (* x t))))))))assert(y < t);
double code(double x, double y, double z, double t) {
double t_1 = t * (y * x);
double tmp;
if (x <= -1.35e+63) {
tmp = t_1;
} else if (x <= 5.2e+37) {
tmp = y * (t * -z);
} else if (x <= 3.2e+104) {
tmp = t_1;
} else if (x <= 4.9e+134) {
tmp = z * (t * -y);
} else {
tmp = y * (x * t);
}
return tmp;
}
NOTE: y and t should be sorted in increasing order before calling this function.
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 = t * (y * x)
if (x <= (-1.35d+63)) then
tmp = t_1
else if (x <= 5.2d+37) then
tmp = y * (t * -z)
else if (x <= 3.2d+104) then
tmp = t_1
else if (x <= 4.9d+134) then
tmp = z * (t * -y)
else
tmp = y * (x * t)
end if
code = tmp
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
double t_1 = t * (y * x);
double tmp;
if (x <= -1.35e+63) {
tmp = t_1;
} else if (x <= 5.2e+37) {
tmp = y * (t * -z);
} else if (x <= 3.2e+104) {
tmp = t_1;
} else if (x <= 4.9e+134) {
tmp = z * (t * -y);
} else {
tmp = y * (x * t);
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): t_1 = t * (y * x) tmp = 0 if x <= -1.35e+63: tmp = t_1 elif x <= 5.2e+37: tmp = y * (t * -z) elif x <= 3.2e+104: tmp = t_1 elif x <= 4.9e+134: tmp = z * (t * -y) else: tmp = y * (x * t) return tmp
y, t = sort([y, t]) function code(x, y, z, t) t_1 = Float64(t * Float64(y * x)) tmp = 0.0 if (x <= -1.35e+63) tmp = t_1; elseif (x <= 5.2e+37) tmp = Float64(y * Float64(t * Float64(-z))); elseif (x <= 3.2e+104) tmp = t_1; elseif (x <= 4.9e+134) tmp = Float64(z * Float64(t * Float64(-y))); else tmp = Float64(y * Float64(x * t)); end return tmp end
y, t = num2cell(sort([y, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = t * (y * x);
tmp = 0.0;
if (x <= -1.35e+63)
tmp = t_1;
elseif (x <= 5.2e+37)
tmp = y * (t * -z);
elseif (x <= 3.2e+104)
tmp = t_1;
elseif (x <= 4.9e+134)
tmp = z * (t * -y);
else
tmp = y * (x * t);
end
tmp_2 = tmp;
end
NOTE: y and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.35e+63], t$95$1, If[LessEqual[x, 5.2e+37], N[(y * N[(t * (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.2e+104], t$95$1, If[LessEqual[x, 4.9e+134], N[(z * N[(t * (-y)), $MachinePrecision]), $MachinePrecision], N[(y * N[(x * t), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
\begin{array}{l}
t_1 := t \cdot \left(y \cdot x\right)\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+63}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{+37}:\\
\;\;\;\;y \cdot \left(t \cdot \left(-z\right)\right)\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{+104}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.9 \cdot 10^{+134}:\\
\;\;\;\;z \cdot \left(t \cdot \left(-y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot t\right)\\
\end{array}
\end{array}
if x < -1.35000000000000009e63 or 5.1999999999999998e37 < x < 3.2e104Initial program 87.6%
distribute-rgt-out--92.6%
Simplified92.6%
Taylor expanded in x around inf 81.7%
if -1.35000000000000009e63 < x < 5.1999999999999998e37Initial program 95.6%
distribute-rgt-out--95.6%
associate-*l*94.9%
Simplified94.9%
Taylor expanded in x around 0 77.7%
associate-*r*77.7%
neg-mul-177.7%
Simplified77.7%
if 3.2e104 < x < 4.89999999999999996e134Initial program 99.6%
distribute-rgt-out--99.6%
associate-*l*72.3%
Simplified72.3%
Taylor expanded in x around 0 51.3%
associate-*r*51.3%
neg-mul-151.3%
Simplified51.3%
distribute-lft-neg-out51.3%
add-sqr-sqrt50.5%
sqrt-unprod35.5%
sqr-neg35.5%
sqrt-unprod0.0%
add-sqr-sqrt15.2%
associate-*r*15.2%
*-commutative15.2%
*-commutative15.2%
add-sqr-sqrt0.1%
sqrt-unprod36.1%
sqr-neg36.1%
sqrt-unprod63.7%
add-sqr-sqrt78.3%
Applied egg-rr78.3%
if 4.89999999999999996e134 < x Initial program 78.0%
distribute-rgt-out--84.7%
associate-*l*84.9%
Simplified84.9%
Taylor expanded in x around inf 72.7%
Final simplification78.3%
NOTE: y and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (* y x))))
(if (<= x -6e+62)
t_1
(if (<= x 2.7e+37)
(* t (* y (- z)))
(if (<= x 3.4e+105)
t_1
(if (<= x 5.8e+128) (* z (* t (- y))) (* y (* x t))))))))assert(y < t);
double code(double x, double y, double z, double t) {
double t_1 = t * (y * x);
double tmp;
if (x <= -6e+62) {
tmp = t_1;
} else if (x <= 2.7e+37) {
tmp = t * (y * -z);
} else if (x <= 3.4e+105) {
tmp = t_1;
} else if (x <= 5.8e+128) {
tmp = z * (t * -y);
} else {
tmp = y * (x * t);
}
return tmp;
}
NOTE: y and t should be sorted in increasing order before calling this function.
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 = t * (y * x)
if (x <= (-6d+62)) then
tmp = t_1
else if (x <= 2.7d+37) then
tmp = t * (y * -z)
else if (x <= 3.4d+105) then
tmp = t_1
else if (x <= 5.8d+128) then
tmp = z * (t * -y)
else
tmp = y * (x * t)
end if
code = tmp
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
double t_1 = t * (y * x);
double tmp;
if (x <= -6e+62) {
tmp = t_1;
} else if (x <= 2.7e+37) {
tmp = t * (y * -z);
} else if (x <= 3.4e+105) {
tmp = t_1;
} else if (x <= 5.8e+128) {
tmp = z * (t * -y);
} else {
tmp = y * (x * t);
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): t_1 = t * (y * x) tmp = 0 if x <= -6e+62: tmp = t_1 elif x <= 2.7e+37: tmp = t * (y * -z) elif x <= 3.4e+105: tmp = t_1 elif x <= 5.8e+128: tmp = z * (t * -y) else: tmp = y * (x * t) return tmp
y, t = sort([y, t]) function code(x, y, z, t) t_1 = Float64(t * Float64(y * x)) tmp = 0.0 if (x <= -6e+62) tmp = t_1; elseif (x <= 2.7e+37) tmp = Float64(t * Float64(y * Float64(-z))); elseif (x <= 3.4e+105) tmp = t_1; elseif (x <= 5.8e+128) tmp = Float64(z * Float64(t * Float64(-y))); else tmp = Float64(y * Float64(x * t)); end return tmp end
y, t = num2cell(sort([y, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = t * (y * x);
tmp = 0.0;
if (x <= -6e+62)
tmp = t_1;
elseif (x <= 2.7e+37)
tmp = t * (y * -z);
elseif (x <= 3.4e+105)
tmp = t_1;
elseif (x <= 5.8e+128)
tmp = z * (t * -y);
else
tmp = y * (x * t);
end
tmp_2 = tmp;
end
NOTE: y and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6e+62], t$95$1, If[LessEqual[x, 2.7e+37], N[(t * N[(y * (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.4e+105], t$95$1, If[LessEqual[x, 5.8e+128], N[(z * N[(t * (-y)), $MachinePrecision]), $MachinePrecision], N[(y * N[(x * t), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
\begin{array}{l}
t_1 := t \cdot \left(y \cdot x\right)\\
\mathbf{if}\;x \leq -6 \cdot 10^{+62}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{+37}:\\
\;\;\;\;t \cdot \left(y \cdot \left(-z\right)\right)\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{+105}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{+128}:\\
\;\;\;\;z \cdot \left(t \cdot \left(-y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot t\right)\\
\end{array}
\end{array}
if x < -6e62 or 2.69999999999999986e37 < x < 3.3999999999999999e105Initial program 87.6%
distribute-rgt-out--92.6%
Simplified92.6%
Taylor expanded in x around inf 81.7%
if -6e62 < x < 2.69999999999999986e37Initial program 95.6%
distribute-rgt-out--95.6%
Simplified95.6%
Taylor expanded in x around 0 79.6%
neg-mul-179.6%
distribute-lft-neg-in79.6%
Simplified79.6%
if 3.3999999999999999e105 < x < 5.8000000000000001e128Initial program 99.6%
distribute-rgt-out--99.6%
associate-*l*72.3%
Simplified72.3%
Taylor expanded in x around 0 51.3%
associate-*r*51.3%
neg-mul-151.3%
Simplified51.3%
distribute-lft-neg-out51.3%
add-sqr-sqrt50.5%
sqrt-unprod35.5%
sqr-neg35.5%
sqrt-unprod0.0%
add-sqr-sqrt15.2%
associate-*r*15.2%
*-commutative15.2%
*-commutative15.2%
add-sqr-sqrt0.1%
sqrt-unprod36.1%
sqr-neg36.1%
sqrt-unprod63.7%
add-sqr-sqrt78.3%
Applied egg-rr78.3%
if 5.8000000000000001e128 < x Initial program 78.0%
distribute-rgt-out--84.7%
associate-*l*84.9%
Simplified84.9%
Taylor expanded in x around inf 72.7%
Final simplification79.4%
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= t 3.1e+29) (* y (* (- x z) t)) (* (- x z) (* y t))))
assert(y < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.1e+29) {
tmp = y * ((x - z) * t);
} else {
tmp = (x - z) * (y * t);
}
return tmp;
}
NOTE: y and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 3.1d+29) then
tmp = y * ((x - z) * t)
else
tmp = (x - z) * (y * t)
end if
code = tmp
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.1e+29) {
tmp = y * ((x - z) * t);
} else {
tmp = (x - z) * (y * t);
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): tmp = 0 if t <= 3.1e+29: tmp = y * ((x - z) * t) else: tmp = (x - z) * (y * t) return tmp
y, t = sort([y, t]) function code(x, y, z, t) tmp = 0.0 if (t <= 3.1e+29) tmp = Float64(y * Float64(Float64(x - z) * t)); else tmp = Float64(Float64(x - z) * Float64(y * t)); end return tmp end
y, t = num2cell(sort([y, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (t <= 3.1e+29)
tmp = y * ((x - z) * t);
else
tmp = (x - z) * (y * t);
end
tmp_2 = tmp;
end
NOTE: y and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[t, 3.1e+29], N[(y * N[(N[(x - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(N[(x - z), $MachinePrecision] * N[(y * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.1 \cdot 10^{+29}:\\
\;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\
\end{array}
\end{array}
if t < 3.0999999999999999e29Initial program 89.5%
distribute-rgt-out--92.1%
associate-*l*94.5%
Simplified94.5%
if 3.0999999999999999e29 < t Initial program 96.5%
distribute-rgt-out--98.2%
associate-*l*80.7%
Simplified80.7%
associate-*r*98.2%
distribute-rgt-out--96.5%
*-commutative96.5%
sub-neg96.5%
distribute-rgt-in89.8%
*-commutative89.8%
*-commutative89.8%
Applied egg-rr89.8%
Taylor expanded in y around 0 75.3%
+-commutative75.3%
mul-1-neg75.3%
distribute-rgt-neg-in75.3%
distribute-lft-in80.7%
sub-neg80.7%
associate-*r*96.7%
Simplified96.7%
Final simplification95.0%
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -9e+39) (* y (* x t)) (* t (* y x))))
assert(y < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9e+39) {
tmp = y * (x * t);
} else {
tmp = t * (y * x);
}
return tmp;
}
NOTE: y and t should be sorted in increasing order before calling this function.
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 <= (-9d+39)) then
tmp = y * (x * t)
else
tmp = t * (y * x)
end if
code = tmp
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9e+39) {
tmp = y * (x * t);
} else {
tmp = t * (y * x);
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): tmp = 0 if y <= -9e+39: tmp = y * (x * t) else: tmp = t * (y * x) return tmp
y, t = sort([y, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -9e+39) tmp = Float64(y * Float64(x * t)); else tmp = Float64(t * Float64(y * x)); end return tmp end
y, t = num2cell(sort([y, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -9e+39)
tmp = y * (x * t);
else
tmp = t * (y * x);
end
tmp_2 = tmp;
end
NOTE: y and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -9e+39], N[(y * N[(x * t), $MachinePrecision]), $MachinePrecision], N[(t * N[(y * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{+39}:\\
\;\;\;\;y \cdot \left(x \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot x\right)\\
\end{array}
\end{array}
if y < -8.99999999999999991e39Initial program 80.9%
distribute-rgt-out--89.6%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in x around inf 70.0%
if -8.99999999999999991e39 < y Initial program 93.3%
distribute-rgt-out--94.3%
Simplified94.3%
Taylor expanded in x around inf 51.8%
Final simplification55.1%
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* y (* (- x z) t)))
assert(y < t);
double code(double x, double y, double z, double t) {
return y * ((x - z) * t);
}
NOTE: y and t should be sorted in increasing order before calling this function.
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 = y * ((x - z) * t)
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
return y * ((x - z) * t);
}
[y, t] = sort([y, t]) def code(x, y, z, t): return y * ((x - z) * t)
y, t = sort([y, t]) function code(x, y, z, t) return Float64(y * Float64(Float64(x - z) * t)) end
y, t = num2cell(sort([y, t])){:}
function tmp = code(x, y, z, t)
tmp = y * ((x - z) * t);
end
NOTE: y and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(y * N[(N[(x - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
y \cdot \left(\left(x - z\right) \cdot t\right)
\end{array}
Initial program 91.1%
distribute-rgt-out--93.5%
associate-*l*91.3%
Simplified91.3%
Final simplification91.3%
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* y (* x t)))
assert(y < t);
double code(double x, double y, double z, double t) {
return y * (x * t);
}
NOTE: y and t should be sorted in increasing order before calling this function.
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 = y * (x * t)
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
return y * (x * t);
}
[y, t] = sort([y, t]) def code(x, y, z, t): return y * (x * t)
y, t = sort([y, t]) function code(x, y, z, t) return Float64(y * Float64(x * t)) end
y, t = num2cell(sort([y, t])){:}
function tmp = code(x, y, z, t)
tmp = y * (x * t);
end
NOTE: y and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(y * N[(x * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
y \cdot \left(x \cdot t\right)
\end{array}
Initial program 91.1%
distribute-rgt-out--93.5%
associate-*l*91.3%
Simplified91.3%
Taylor expanded in x around inf 53.6%
Final simplification53.6%
(FPCore (x y z t) :precision binary64 (if (< t -9.231879582886777e-80) (* (* y t) (- x z)) (if (< t 2.543067051564877e+83) (* y (* t (- x z))) (* (* y (- x z)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t < -9.231879582886777e-80) {
tmp = (y * t) * (x - z);
} else if (t < 2.543067051564877e+83) {
tmp = y * (t * (x - z));
} else {
tmp = (y * (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) :: tmp
if (t < (-9.231879582886777d-80)) then
tmp = (y * t) * (x - z)
else if (t < 2.543067051564877d+83) then
tmp = y * (t * (x - z))
else
tmp = (y * (x - z)) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t < -9.231879582886777e-80) {
tmp = (y * t) * (x - z);
} else if (t < 2.543067051564877e+83) {
tmp = y * (t * (x - z));
} else {
tmp = (y * (x - z)) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t < -9.231879582886777e-80: tmp = (y * t) * (x - z) elif t < 2.543067051564877e+83: tmp = y * (t * (x - z)) else: tmp = (y * (x - z)) * t return tmp
function code(x, y, z, t) tmp = 0.0 if (t < -9.231879582886777e-80) tmp = Float64(Float64(y * t) * Float64(x - z)); elseif (t < 2.543067051564877e+83) tmp = Float64(y * Float64(t * Float64(x - z))); else tmp = Float64(Float64(y * Float64(x - z)) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t < -9.231879582886777e-80) tmp = (y * t) * (x - z); elseif (t < 2.543067051564877e+83) tmp = y * (t * (x - z)); else tmp = (y * (x - z)) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Less[t, -9.231879582886777e-80], N[(N[(y * t), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision], If[Less[t, 2.543067051564877e+83], N[(y * N[(t * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(x - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t < -9.231879582886777 \cdot 10^{-80}:\\
\;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\
\mathbf{elif}\;t < 2.543067051564877 \cdot 10^{+83}:\\
\;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\
\end{array}
\end{array}
herbie shell --seed 2023171
(FPCore (x y z t)
:name "Linear.Projection:inverseInfinitePerspective from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< t -9.231879582886777e-80) (* (* y t) (- x z)) (if (< t 2.543067051564877e+83) (* y (* t (- x z))) (* (* y (- x z)) t)))
(* (- (* x y) (* z y)) t))