
(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 -16600000000000.0) (* y (* t (- x z))) (* t (- (* y x) (* y z)))))
assert(y < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -16600000000000.0) {
tmp = y * (t * (x - z));
} 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 <= (-16600000000000.0d0)) then
tmp = y * (t * (x - z))
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 <= -16600000000000.0) {
tmp = y * (t * (x - z));
} else {
tmp = t * ((y * x) - (y * z));
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): tmp = 0 if y <= -16600000000000.0: tmp = y * (t * (x - z)) 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 <= -16600000000000.0) tmp = Float64(y * Float64(t * Float64(x - z))); 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 <= -16600000000000.0)
tmp = y * (t * (x - z));
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, -16600000000000.0], N[(y * N[(t * N[(x - z), $MachinePrecision]), $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 -16600000000000:\\
\;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -1.66e13Initial program 69.4%
distribute-rgt-out--73.1%
associate-*l*96.4%
*-commutative96.4%
Simplified96.4%
if -1.66e13 < y Initial program 94.2%
Final simplification94.7%
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 (* z (- t)))))
(if (<= z -2.1e-94)
t_2
(if (<= z 3.8e-237)
t_1
(if (<= z 3.45e+18) (* x (* y t)) (if (<= z 5e+28) 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 * (z * -t);
double tmp;
if (z <= -2.1e-94) {
tmp = t_2;
} else if (z <= 3.8e-237) {
tmp = t_1;
} else if (z <= 3.45e+18) {
tmp = x * (y * t);
} else if (z <= 5e+28) {
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 * (z * -t)
if (z <= (-2.1d-94)) then
tmp = t_2
else if (z <= 3.8d-237) then
tmp = t_1
else if (z <= 3.45d+18) then
tmp = x * (y * t)
else if (z <= 5d+28) 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 * (z * -t);
double tmp;
if (z <= -2.1e-94) {
tmp = t_2;
} else if (z <= 3.8e-237) {
tmp = t_1;
} else if (z <= 3.45e+18) {
tmp = x * (y * t);
} else if (z <= 5e+28) {
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 * (z * -t) tmp = 0 if z <= -2.1e-94: tmp = t_2 elif z <= 3.8e-237: tmp = t_1 elif z <= 3.45e+18: tmp = x * (y * t) elif z <= 5e+28: 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(z * Float64(-t))) tmp = 0.0 if (z <= -2.1e-94) tmp = t_2; elseif (z <= 3.8e-237) tmp = t_1; elseif (z <= 3.45e+18) tmp = Float64(x * Float64(y * t)); elseif (z <= 5e+28) 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 * (z * -t);
tmp = 0.0;
if (z <= -2.1e-94)
tmp = t_2;
elseif (z <= 3.8e-237)
tmp = t_1;
elseif (z <= 3.45e+18)
tmp = x * (y * t);
elseif (z <= 5e+28)
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[(z * (-t)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.1e-94], t$95$2, If[LessEqual[z, 3.8e-237], t$95$1, If[LessEqual[z, 3.45e+18], N[(x * N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e+28], 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(z \cdot \left(-t\right)\right)\\
\mathbf{if}\;z \leq -2.1 \cdot 10^{-94}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-237}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 3.45 \cdot 10^{+18}:\\
\;\;\;\;x \cdot \left(y \cdot t\right)\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+28}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -2.1000000000000001e-94 or 4.99999999999999957e28 < z Initial program 83.9%
distribute-rgt-out--86.2%
associate-*l*90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in x around 0 76.4%
associate-*r*76.4%
neg-mul-176.4%
Simplified76.4%
if -2.1000000000000001e-94 < z < 3.80000000000000024e-237 or 3.45e18 < z < 4.99999999999999957e28Initial program 95.6%
distribute-rgt-out--95.6%
Simplified95.6%
Taylor expanded in x around inf 88.2%
*-commutative88.2%
Simplified88.2%
if 3.80000000000000024e-237 < z < 3.45e18Initial program 93.2%
distribute-rgt-out--93.2%
associate-*l*88.1%
*-commutative88.1%
Simplified88.1%
Taylor expanded in x around inf 70.5%
*-commutative70.5%
associate-*r*75.5%
Simplified75.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 (* z (- t)))
(if (<= z 7.5e-237)
t_1
(if (<= z 8.8e+18)
(* x (* y t))
(if (<= z 3e+31) 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 * (z * -t);
} else if (z <= 7.5e-237) {
tmp = t_1;
} else if (z <= 8.8e+18) {
tmp = x * (y * t);
} else if (z <= 3e+31) {
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 * (z * -t)
else if (z <= 7.5d-237) then
tmp = t_1
else if (z <= 8.8d+18) then
tmp = x * (y * t)
else if (z <= 3d+31) 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 * (z * -t);
} else if (z <= 7.5e-237) {
tmp = t_1;
} else if (z <= 8.8e+18) {
tmp = x * (y * t);
} else if (z <= 3e+31) {
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 * (z * -t) elif z <= 7.5e-237: tmp = t_1 elif z <= 8.8e+18: tmp = x * (y * t) elif z <= 3e+31: 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(z * Float64(-t))); elseif (z <= 7.5e-237) tmp = t_1; elseif (z <= 8.8e+18) tmp = Float64(x * Float64(y * t)); elseif (z <= 3e+31) 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 * (z * -t);
elseif (z <= 7.5e-237)
tmp = t_1;
elseif (z <= 8.8e+18)
tmp = x * (y * t);
elseif (z <= 3e+31)
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[(z * (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.5e-237], t$95$1, If[LessEqual[z, 8.8e+18], N[(x * N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3e+31], 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(z \cdot \left(-t\right)\right)\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-237}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{+18}:\\
\;\;\;\;x \cdot \left(y \cdot t\right)\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+31}:\\
\;\;\;\;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%
distribute-rgt-out--86.5%
associate-*l*95.8%
*-commutative95.8%
Simplified95.8%
Taylor expanded in x around 0 79.7%
associate-*r*79.7%
neg-mul-179.7%
Simplified79.7%
if -2.1000000000000001e-94 < z < 7.50000000000000034e-237 or 8.8e18 < z < 2.99999999999999989e31Initial 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 < 8.8e18Initial program 93.2%
distribute-rgt-out--93.2%
associate-*l*88.1%
*-commutative88.1%
Simplified88.1%
Taylor expanded in x around inf 70.5%
*-commutative70.5%
associate-*r*75.5%
Simplified75.5%
if 2.99999999999999989e31 < z Initial program 82.8%
distribute-rgt-out--85.8%
associate-*l*85.7%
*-commutative85.7%
Simplified85.7%
flip--43.3%
associate-*r/40.4%
clear-num40.4%
un-div-inv40.4%
clear-num40.4%
associate-*r/43.3%
flip--85.6%
Applied egg-rr85.6%
Taylor expanded in x around 0 72.8%
div-inv72.8%
frac-2neg72.8%
metadata-eval72.8%
remove-double-div72.9%
distribute-lft-neg-in72.9%
associate-*r*78.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 (<= t 200000.0) (* y (* t (- x z))) (* (- x z) (* y t))))
assert(y < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 200000.0) {
tmp = y * (t * (x - z));
} 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 <= 200000.0d0) then
tmp = y * (t * (x - z))
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 <= 200000.0) {
tmp = y * (t * (x - z));
} else {
tmp = (x - z) * (y * t);
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): tmp = 0 if t <= 200000.0: tmp = y * (t * (x - z)) else: tmp = (x - z) * (y * t) return tmp
y, t = sort([y, t]) function code(x, y, z, t) tmp = 0.0 if (t <= 200000.0) tmp = Float64(y * Float64(t * Float64(x - z))); 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 <= 200000.0)
tmp = y * (t * (x - z));
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, 200000.0], N[(y * N[(t * N[(x - z), $MachinePrecision]), $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 200000:\\
\;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\
\end{array}
\end{array}
if t < 2e5Initial program 86.6%
distribute-rgt-out--87.7%
associate-*l*92.8%
*-commutative92.8%
Simplified92.8%
if 2e5 < t Initial program 94.7%
*-commutative94.7%
distribute-rgt-out--96.1%
associate-*r*94.3%
*-commutative94.3%
Simplified94.3%
Final simplification93.2%
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -21500000000000.0) (* y (* t (- x z))) (* t (* y (- x z)))))
assert(y < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -21500000000000.0) {
tmp = y * (t * (x - z));
} 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 <= (-21500000000000.0d0)) then
tmp = y * (t * (x - z))
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 <= -21500000000000.0) {
tmp = y * (t * (x - z));
} else {
tmp = t * (y * (x - z));
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): tmp = 0 if y <= -21500000000000.0: tmp = y * (t * (x - z)) else: tmp = t * (y * (x - z)) return tmp
y, t = sort([y, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -21500000000000.0) tmp = Float64(y * Float64(t * Float64(x - z))); 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 <= -21500000000000.0)
tmp = y * (t * (x - z));
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, -21500000000000.0], N[(y * N[(t * N[(x - z), $MachinePrecision]), $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 -21500000000000:\\
\;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\
\end{array}
\end{array}
if y < -2.15e13Initial program 69.4%
distribute-rgt-out--73.1%
associate-*l*96.4%
*-commutative96.4%
Simplified96.4%
if -2.15e13 < y Initial program 94.2%
distribute-rgt-out--94.7%
Simplified94.7%
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 -17000000000000.0) (* y (* t x)) (* t (* y x))))
assert(y < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -17000000000000.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 <= (-17000000000000.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 <= -17000000000000.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 <= -17000000000000.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 <= -17000000000000.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 <= -17000000000000.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, -17000000000000.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 -17000000000000:\\
\;\;\;\;y \cdot \left(t \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot x\right)\\
\end{array}
\end{array}
if y < -1.7e13Initial program 69.4%
distribute-rgt-out--73.1%
associate-*l*96.4%
*-commutative96.4%
Simplified96.4%
Taylor expanded in x around inf 48.1%
if -1.7e13 < 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 (* y (* t (- x z))))
assert(y < t);
double code(double x, double y, double z, double t) {
return y * (t * (x - z));
}
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 - z))
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
return y * (t * (x - z));
}
[y, t] = sort([y, t]) def code(x, y, z, t): return y * (t * (x - z))
y, t = sort([y, t]) function code(x, y, z, t) return Float64(y * Float64(t * Float64(x - z))) end
y, t = num2cell(sort([y, t])){:}
function tmp = code(x, y, z, t)
tmp = y * (t * (x - z));
end
NOTE: y and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(y * N[(t * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
y \cdot \left(t \cdot \left(x - z\right)\right)
\end{array}
Initial program 88.8%
distribute-rgt-out--90.0%
associate-*l*90.9%
*-commutative90.9%
Simplified90.9%
Final simplification90.9%
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%
distribute-rgt-out--90.0%
associate-*l*90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in x around inf 49.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))