
(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 -22000000000000.0) (pow (cbrt (* y (* t (- x z)))) 3.0) (* t (- (* y x) (* y z)))))
assert(y < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -22000000000000.0) {
tmp = pow(cbrt((y * (t * (x - z)))), 3.0);
} else {
tmp = t * ((y * x) - (y * z));
}
return tmp;
}
assert y < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -22000000000000.0) {
tmp = Math.pow(Math.cbrt((y * (t * (x - z)))), 3.0);
} else {
tmp = t * ((y * x) - (y * z));
}
return tmp;
}
y, t = sort([y, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -22000000000000.0) tmp = cbrt(Float64(y * Float64(t * Float64(x - z)))) ^ 3.0; else tmp = Float64(t * Float64(Float64(y * x) - Float64(y * z))); end return tmp end
NOTE: y and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -22000000000000.0], N[Power[N[Power[N[(y * N[(t * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision], N[(t * N[(N[(y * x), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -22000000000000:\\
\;\;\;\;{\left(\sqrt[3]{y \cdot \left(t \cdot \left(x - z\right)\right)}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -2.2e13Initial program 69.4%
*-commutative69.4%
distribute-rgt-out--73.1%
associate-*r*96.3%
*-commutative96.3%
Simplified96.3%
add-cube-cbrt95.5%
pow395.6%
associate-*l*95.5%
Applied egg-rr95.5%
if -2.2e13 < y Initial program 94.2%
Final simplification94.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))) (t_2 (* y (* t (- z)))))
(if (<= z -2.1e-94)
t_2
(if (<= z 7.5e-237)
t_1
(if (<= z 5e+14) (* x (* y t)) (if (<= z 1.55e+29) t_1 t_2))))))assert(y < t);
double code(double x, double y, double z, double t) {
double t_1 = t * (y * x);
double t_2 = y * (t * -z);
double tmp;
if (z <= -2.1e-94) {
tmp = t_2;
} else if (z <= 7.5e-237) {
tmp = t_1;
} else if (z <= 5e+14) {
tmp = x * (y * t);
} else if (z <= 1.55e+29) {
tmp = t_1;
} else {
tmp = t_2;
}
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 = y * (t * -z)
if (z <= (-2.1d-94)) then
tmp = t_2
else if (z <= 7.5d-237) then
tmp = t_1
else if (z <= 5d+14) then
tmp = x * (y * t)
else if (z <= 1.55d+29) then
tmp = t_1
else
tmp = t_2
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 = y * (t * -z);
double tmp;
if (z <= -2.1e-94) {
tmp = t_2;
} else if (z <= 7.5e-237) {
tmp = t_1;
} else if (z <= 5e+14) {
tmp = x * (y * t);
} else if (z <= 1.55e+29) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): t_1 = t * (y * x) t_2 = y * (t * -z) tmp = 0 if z <= -2.1e-94: tmp = t_2 elif z <= 7.5e-237: tmp = t_1 elif z <= 5e+14: tmp = x * (y * t) elif z <= 1.55e+29: tmp = t_1 else: tmp = t_2 return tmp
y, t = sort([y, t]) function code(x, y, z, t) t_1 = Float64(t * Float64(y * x)) t_2 = Float64(y * Float64(t * Float64(-z))) tmp = 0.0 if (z <= -2.1e-94) tmp = t_2; elseif (z <= 7.5e-237) tmp = t_1; elseif (z <= 5e+14) tmp = Float64(x * Float64(y * t)); elseif (z <= 1.55e+29) tmp = t_1; else tmp = t_2; 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 = y * (t * -z);
tmp = 0.0;
if (z <= -2.1e-94)
tmp = t_2;
elseif (z <= 7.5e-237)
tmp = t_1;
elseif (z <= 5e+14)
tmp = x * (y * t);
elseif (z <= 1.55e+29)
tmp = t_1;
else
tmp = t_2;
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[(y * N[(t * (-z)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.1e-94], t$95$2, If[LessEqual[z, 7.5e-237], t$95$1, If[LessEqual[z, 5e+14], N[(x * N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.55e+29], t$95$1, t$95$2]]]]]]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
\begin{array}{l}
t_1 := t \cdot \left(y \cdot x\right)\\
t_2 := y \cdot \left(t \cdot \left(-z\right)\right)\\
\mathbf{if}\;z \leq -2.1 \cdot 10^{-94}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-237}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+14}:\\
\;\;\;\;x \cdot \left(y \cdot t\right)\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{+29}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -2.1000000000000001e-94 or 1.5499999999999999e29 < z Initial program 83.9%
*-commutative83.9%
distribute-rgt-out--86.2%
associate-*r*90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in x around 0 73.9%
mul-1-neg73.9%
*-commutative73.9%
associate-*l*76.4%
distribute-lft-neg-in76.4%
*-commutative76.4%
Simplified76.4%
if -2.1000000000000001e-94 < z < 7.50000000000000034e-237 or 5e14 < z < 1.5499999999999999e29Initial program 95.6%
distribute-rgt-out--95.6%
Simplified95.6%
Taylor expanded in x around inf 88.2%
*-commutative88.2%
Simplified88.2%
if 7.50000000000000034e-237 < z < 5e14Initial program 93.2%
*-commutative93.2%
distribute-rgt-out--93.2%
associate-*r*96.5%
*-commutative96.5%
Simplified96.5%
flip3--63.5%
associate-*r/55.5%
fma-def55.5%
distribute-rgt-out55.5%
+-commutative55.5%
Applied egg-rr55.5%
associate-/l*63.4%
*-commutative63.4%
Simplified63.4%
Taylor expanded in x around inf 75.5%
associate-/r/75.5%
/-rgt-identity75.5%
Applied egg-rr75.5%
Final simplification79.0%
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 (<= z -2.1e-94)
(* y (* t (- z)))
(if (<= z 3e-237)
t_1
(if (<= z 1.15e+18)
(* x (* y t))
(if (<= z 8.5e+27) t_1 (* z (* y (- t)))))))))assert(y < t);
double code(double x, double y, double z, double t) {
double t_1 = t * (y * x);
double tmp;
if (z <= -2.1e-94) {
tmp = y * (t * -z);
} else if (z <= 3e-237) {
tmp = t_1;
} else if (z <= 1.15e+18) {
tmp = x * (y * t);
} else if (z <= 8.5e+27) {
tmp = t_1;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_1 = t * (y * x)
if (z <= (-2.1d-94)) then
tmp = y * (t * -z)
else if (z <= 3d-237) then
tmp = t_1
else if (z <= 1.15d+18) then
tmp = x * (y * t)
else if (z <= 8.5d+27) then
tmp = t_1
else
tmp = 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 t_1 = t * (y * x);
double tmp;
if (z <= -2.1e-94) {
tmp = y * (t * -z);
} else if (z <= 3e-237) {
tmp = t_1;
} else if (z <= 1.15e+18) {
tmp = x * (y * t);
} else if (z <= 8.5e+27) {
tmp = t_1;
} else {
tmp = z * (y * -t);
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): t_1 = t * (y * x) tmp = 0 if z <= -2.1e-94: tmp = y * (t * -z) elif z <= 3e-237: tmp = t_1 elif z <= 1.15e+18: tmp = x * (y * t) elif z <= 8.5e+27: tmp = t_1 else: tmp = z * (y * -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 (z <= -2.1e-94) tmp = Float64(y * Float64(t * Float64(-z))); elseif (z <= 3e-237) tmp = t_1; elseif (z <= 1.15e+18) tmp = Float64(x * Float64(y * t)); elseif (z <= 8.5e+27) tmp = t_1; else tmp = Float64(z * Float64(y * Float64(-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 (z <= -2.1e-94)
tmp = y * (t * -z);
elseif (z <= 3e-237)
tmp = t_1;
elseif (z <= 1.15e+18)
tmp = x * (y * t);
elseif (z <= 8.5e+27)
tmp = t_1;
else
tmp = 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_] := Block[{t$95$1 = N[(t * N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.1e-94], N[(y * N[(t * (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3e-237], t$95$1, If[LessEqual[z, 1.15e+18], N[(x * N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.5e+27], t$95$1, N[(z * N[(y * (-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}\;z \leq -2.1 \cdot 10^{-94}:\\
\;\;\;\;y \cdot \left(t \cdot \left(-z\right)\right)\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-237}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+18}:\\
\;\;\;\;x \cdot \left(y \cdot t\right)\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+27}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot \left(-t\right)\right)\\
\end{array}
\end{array}
if z < -2.1000000000000001e-94Initial program 85.0%
*-commutative85.0%
distribute-rgt-out--86.5%
associate-*r*90.1%
*-commutative90.1%
Simplified90.1%
Taylor expanded in x around 0 74.3%
mul-1-neg74.3%
*-commutative74.3%
associate-*l*79.7%
distribute-lft-neg-in79.7%
*-commutative79.7%
Simplified79.7%
if -2.1000000000000001e-94 < z < 3.00000000000000024e-237 or 1.15e18 < z < 8.5e27Initial program 95.6%
distribute-rgt-out--95.6%
Simplified95.6%
Taylor expanded in x around inf 88.2%
*-commutative88.2%
Simplified88.2%
if 3.00000000000000024e-237 < z < 1.15e18Initial program 93.2%
*-commutative93.2%
distribute-rgt-out--93.2%
associate-*r*96.5%
*-commutative96.5%
Simplified96.5%
flip3--63.5%
associate-*r/55.5%
fma-def55.5%
distribute-rgt-out55.5%
+-commutative55.5%
Applied egg-rr55.5%
associate-/l*63.4%
*-commutative63.4%
Simplified63.4%
Taylor expanded in x around inf 75.5%
associate-/r/75.5%
/-rgt-identity75.5%
Applied egg-rr75.5%
if 8.5e27 < z Initial program 82.8%
*-commutative82.8%
distribute-rgt-out--85.8%
associate-*r*91.1%
*-commutative91.1%
Simplified91.1%
flip3--21.2%
associate-*r/18.4%
fma-def18.4%
distribute-rgt-out18.4%
+-commutative18.4%
Applied egg-rr18.4%
associate-/l*21.2%
*-commutative21.2%
Simplified21.2%
Taylor expanded in x around 0 78.7%
frac-2neg78.7%
div-inv78.6%
distribute-rgt-neg-in78.6%
distribute-neg-frac78.6%
add-sqr-sqrt78.4%
sqrt-unprod42.4%
sqr-neg42.4%
sqrt-unprod0.0%
add-sqr-sqrt11.9%
frac-2neg11.9%
frac-2neg11.9%
metadata-eval11.9%
remove-double-div11.9%
add-sqr-sqrt0.0%
sqrt-unprod42.4%
sqr-neg42.4%
sqrt-unprod78.4%
add-sqr-sqrt78.7%
Applied egg-rr78.7%
Final simplification80.5%
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -1000000000.0) (* (- x z) (* y t)) (* t (- (* y x) (* y z)))))
assert(y < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1000000000.0) {
tmp = (x - z) * (y * t);
} else {
tmp = t * ((y * x) - (y * 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 <= (-1000000000.0d0)) then
tmp = (x - z) * (y * t)
else
tmp = t * ((y * x) - (y * 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 <= -1000000000.0) {
tmp = (x - z) * (y * t);
} else {
tmp = t * ((y * x) - (y * z));
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): tmp = 0 if y <= -1000000000.0: tmp = (x - z) * (y * t) else: tmp = t * ((y * x) - (y * z)) return tmp
y, t = sort([y, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -1000000000.0) tmp = Float64(Float64(x - z) * Float64(y * t)); else tmp = Float64(t * Float64(Float64(y * x) - Float64(y * z))); end return tmp end
y, t = num2cell(sort([y, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -1000000000.0)
tmp = (x - z) * (y * t);
else
tmp = t * ((y * x) - (y * 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, -1000000000.0], N[(N[(x - z), $MachinePrecision] * N[(y * t), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(y * x), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1000000000:\\
\;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -1e9Initial program 70.4%
*-commutative70.4%
distribute-rgt-out--74.0%
associate-*r*96.5%
*-commutative96.5%
Simplified96.5%
if -1e9 < y Initial program 94.1%
Final simplification94.7%
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -100000000.0) (* (- x z) (* y t)) (* t (* y (- x z)))))
assert(y < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -100000000.0) {
tmp = (x - z) * (y * 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 <= (-100000000.0d0)) then
tmp = (x - z) * (y * 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 <= -100000000.0) {
tmp = (x - z) * (y * t);
} else {
tmp = t * (y * (x - z));
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): tmp = 0 if y <= -100000000.0: tmp = (x - z) * (y * 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 <= -100000000.0) tmp = Float64(Float64(x - z) * Float64(y * 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 <= -100000000.0)
tmp = (x - z) * (y * 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, -100000000.0], N[(N[(x - z), $MachinePrecision] * N[(y * 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 -100000000:\\
\;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\
\end{array}
\end{array}
if y < -1e8Initial program 70.4%
*-commutative70.4%
distribute-rgt-out--74.0%
associate-*r*96.5%
*-commutative96.5%
Simplified96.5%
if -1e8 < y Initial program 94.1%
distribute-rgt-out--94.6%
Simplified94.6%
Final simplification95.1%
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -20000000000000.0) (* y (* t x)) (* t (* y x))))
assert(y < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -20000000000000.0) {
tmp = y * (t * x);
} 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 <= (-20000000000000.0d0)) then
tmp = y * (t * x)
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 <= -20000000000000.0) {
tmp = y * (t * x);
} else {
tmp = t * (y * x);
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): tmp = 0 if y <= -20000000000000.0: tmp = y * (t * x) else: tmp = t * (y * x) return tmp
y, t = sort([y, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -20000000000000.0) tmp = Float64(y * Float64(t * x)); 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 <= -20000000000000.0)
tmp = y * (t * x);
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, -20000000000000.0], N[(y * N[(t * x), $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 -20000000000000:\\
\;\;\;\;y \cdot \left(t \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot x\right)\\
\end{array}
\end{array}
if y < -2e13Initial program 69.4%
*-commutative69.4%
distribute-rgt-out--73.1%
associate-*r*96.3%
*-commutative96.3%
Simplified96.3%
Taylor expanded in x around inf 45.6%
associate-*r*48.1%
*-commutative48.1%
Simplified48.1%
if -2e13 < y Initial program 94.2%
distribute-rgt-out--94.7%
Simplified94.7%
Taylor expanded in x around inf 52.4%
*-commutative52.4%
Simplified52.4%
Final simplification51.4%
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* (- x z) (* y t)))
assert(y < t);
double code(double x, double y, double z, double t) {
return (x - z) * (y * 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 = (x - z) * (y * t)
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
return (x - z) * (y * t);
}
[y, t] = sort([y, t]) def code(x, y, z, t): return (x - z) * (y * t)
y, t = sort([y, t]) function code(x, y, z, t) return Float64(Float64(x - z) * Float64(y * t)) end
y, t = num2cell(sort([y, t])){:}
function tmp = code(x, y, z, t)
tmp = (x - z) * (y * t);
end
NOTE: y and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(x - z), $MachinePrecision] * N[(y * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
\left(x - z\right) \cdot \left(y \cdot t\right)
\end{array}
Initial program 88.8%
*-commutative88.8%
distribute-rgt-out--90.0%
associate-*r*90.5%
*-commutative90.5%
Simplified90.5%
Final simplification90.5%
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* y (* t x)))
assert(y < t);
double code(double x, double y, double z, double t) {
return y * (t * x);
}
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 * (t * x)
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
return y * (t * x);
}
[y, t] = sort([y, t]) def code(x, y, z, t): return y * (t * x)
y, t = sort([y, t]) function code(x, y, z, t) return Float64(y * Float64(t * x)) end
y, t = num2cell(sort([y, t])){:}
function tmp = code(x, y, z, t)
tmp = y * (t * x);
end
NOTE: y and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(y * N[(t * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
y \cdot \left(t \cdot x\right)
\end{array}
Initial program 88.8%
*-commutative88.8%
distribute-rgt-out--90.0%
associate-*r*90.5%
*-commutative90.5%
Simplified90.5%
Taylor expanded in x around inf 50.9%
associate-*r*49.6%
*-commutative49.6%
Simplified49.6%
Final simplification49.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 2023297
(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))