
(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 7 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 (<= t 1.35e+73) (* y (* t (- x z))) (/ (* t y) (/ 1.0 (- x z)))))
assert(y < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.35e+73) {
tmp = y * (t * (x - z));
} else {
tmp = (t * y) / (1.0 / (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 (t <= 1.35d+73) then
tmp = y * (t * (x - z))
else
tmp = (t * y) / (1.0d0 / (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 (t <= 1.35e+73) {
tmp = y * (t * (x - z));
} else {
tmp = (t * y) / (1.0 / (x - z));
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): tmp = 0 if t <= 1.35e+73: tmp = y * (t * (x - z)) else: tmp = (t * y) / (1.0 / (x - z)) return tmp
y, t = sort([y, t]) function code(x, y, z, t) tmp = 0.0 if (t <= 1.35e+73) tmp = Float64(y * Float64(t * Float64(x - z))); else tmp = Float64(Float64(t * y) / Float64(1.0 / 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 (t <= 1.35e+73)
tmp = y * (t * (x - z));
else
tmp = (t * y) / (1.0 / (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[t, 1.35e+73], N[(y * N[(t * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t * y), $MachinePrecision] / N[(1.0 / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.35 \cdot 10^{+73}:\\
\;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot y}{\frac{1}{x - z}}\\
\end{array}
\end{array}
if t < 1.35e73Initial program 87.5%
distribute-rgt-out--89.6%
associate-*l*92.9%
Simplified92.9%
if 1.35e73 < t Initial program 93.6%
distribute-rgt-out--93.6%
Simplified93.6%
add-cbrt-cube72.9%
pow372.9%
Applied egg-rr72.9%
rem-cbrt-cube93.6%
flip--63.5%
associate-*r/61.4%
Applied egg-rr61.4%
associate-/l*63.4%
difference-of-squares65.6%
associate-/r*93.4%
*-inverses93.4%
Simplified93.4%
associate-*l/97.7%
Applied egg-rr97.7%
Final simplification93.8%
NOTE: y and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z (* t y)))))
(if (<= z -1.1e+90)
t_1
(if (<= z -1e+68)
(* y (* t x))
(if (or (<= z -3.45e-81) (not (<= z 0.012))) t_1 (* x (* t y)))))))assert(y < t);
double code(double x, double y, double z, double t) {
double t_1 = -(z * (t * y));
double tmp;
if (z <= -1.1e+90) {
tmp = t_1;
} else if (z <= -1e+68) {
tmp = y * (t * x);
} else if ((z <= -3.45e-81) || !(z <= 0.012)) {
tmp = t_1;
} else {
tmp = x * (t * y);
}
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 = -(z * (t * y))
if (z <= (-1.1d+90)) then
tmp = t_1
else if (z <= (-1d+68)) then
tmp = y * (t * x)
else if ((z <= (-3.45d-81)) .or. (.not. (z <= 0.012d0))) then
tmp = t_1
else
tmp = x * (t * y)
end if
code = tmp
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
double t_1 = -(z * (t * y));
double tmp;
if (z <= -1.1e+90) {
tmp = t_1;
} else if (z <= -1e+68) {
tmp = y * (t * x);
} else if ((z <= -3.45e-81) || !(z <= 0.012)) {
tmp = t_1;
} else {
tmp = x * (t * y);
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): t_1 = -(z * (t * y)) tmp = 0 if z <= -1.1e+90: tmp = t_1 elif z <= -1e+68: tmp = y * (t * x) elif (z <= -3.45e-81) or not (z <= 0.012): tmp = t_1 else: tmp = x * (t * y) return tmp
y, t = sort([y, t]) function code(x, y, z, t) t_1 = Float64(-Float64(z * Float64(t * y))) tmp = 0.0 if (z <= -1.1e+90) tmp = t_1; elseif (z <= -1e+68) tmp = Float64(y * Float64(t * x)); elseif ((z <= -3.45e-81) || !(z <= 0.012)) tmp = t_1; else tmp = Float64(x * Float64(t * y)); end return tmp end
y, t = num2cell(sort([y, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = -(z * (t * y));
tmp = 0.0;
if (z <= -1.1e+90)
tmp = t_1;
elseif (z <= -1e+68)
tmp = y * (t * x);
elseif ((z <= -3.45e-81) || ~((z <= 0.012)))
tmp = t_1;
else
tmp = x * (t * y);
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[(z * N[(t * y), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[z, -1.1e+90], t$95$1, If[LessEqual[z, -1e+68], N[(y * N[(t * x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -3.45e-81], N[Not[LessEqual[z, 0.012]], $MachinePrecision]], t$95$1, N[(x * N[(t * y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
\begin{array}{l}
t_1 := -z \cdot \left(t \cdot y\right)\\
\mathbf{if}\;z \leq -1.1 \cdot 10^{+90}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1 \cdot 10^{+68}:\\
\;\;\;\;y \cdot \left(t \cdot x\right)\\
\mathbf{elif}\;z \leq -3.45 \cdot 10^{-81} \lor \neg \left(z \leq 0.012\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t \cdot y\right)\\
\end{array}
\end{array}
if z < -1.09999999999999995e90 or -9.99999999999999953e67 < z < -3.4500000000000001e-81 or 0.012 < z Initial program 86.6%
distribute-rgt-out--89.3%
Simplified89.3%
Taylor expanded in x around 0 76.0%
mul-1-neg76.0%
distribute-rgt-neg-out76.0%
Simplified76.0%
distribute-rgt-neg-out76.0%
distribute-lft-neg-out76.0%
*-commutative76.0%
add-sqr-sqrt27.5%
sqrt-unprod20.9%
sqr-neg20.9%
sqrt-unprod3.3%
add-sqr-sqrt4.1%
associate-*l*4.2%
add-sqr-sqrt3.4%
sqrt-unprod21.9%
sqr-neg21.9%
sqrt-unprod30.7%
add-sqr-sqrt80.0%
Applied egg-rr80.0%
if -1.09999999999999995e90 < z < -9.99999999999999953e67Initial program 78.3%
distribute-rgt-out--89.4%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in x around inf 99.8%
if -3.4500000000000001e-81 < z < 0.012Initial program 91.4%
distribute-rgt-out--91.5%
associate-*l*89.7%
Simplified89.7%
Taylor expanded in x around inf 74.5%
add-log-exp29.4%
associate-*r*29.4%
exp-prod28.6%
Applied egg-rr28.6%
log-pow30.5%
rem-log-exp79.6%
Simplified79.6%
Final simplification80.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 (- (* z (* t y)))))
(if (<= z -1.1e+90)
t_1
(if (<= z -7.6e+67)
(* y (* t x))
(if (<= z -3.3e-81)
(* t (* y (- z)))
(if (<= z 0.0032) (* x (* t y)) t_1))))))assert(y < t);
double code(double x, double y, double z, double t) {
double t_1 = -(z * (t * y));
double tmp;
if (z <= -1.1e+90) {
tmp = t_1;
} else if (z <= -7.6e+67) {
tmp = y * (t * x);
} else if (z <= -3.3e-81) {
tmp = t * (y * -z);
} else if (z <= 0.0032) {
tmp = x * (t * y);
} else {
tmp = t_1;
}
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 = -(z * (t * y))
if (z <= (-1.1d+90)) then
tmp = t_1
else if (z <= (-7.6d+67)) then
tmp = y * (t * x)
else if (z <= (-3.3d-81)) then
tmp = t * (y * -z)
else if (z <= 0.0032d0) then
tmp = x * (t * y)
else
tmp = t_1
end if
code = tmp
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
double t_1 = -(z * (t * y));
double tmp;
if (z <= -1.1e+90) {
tmp = t_1;
} else if (z <= -7.6e+67) {
tmp = y * (t * x);
} else if (z <= -3.3e-81) {
tmp = t * (y * -z);
} else if (z <= 0.0032) {
tmp = x * (t * y);
} else {
tmp = t_1;
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): t_1 = -(z * (t * y)) tmp = 0 if z <= -1.1e+90: tmp = t_1 elif z <= -7.6e+67: tmp = y * (t * x) elif z <= -3.3e-81: tmp = t * (y * -z) elif z <= 0.0032: tmp = x * (t * y) else: tmp = t_1 return tmp
y, t = sort([y, t]) function code(x, y, z, t) t_1 = Float64(-Float64(z * Float64(t * y))) tmp = 0.0 if (z <= -1.1e+90) tmp = t_1; elseif (z <= -7.6e+67) tmp = Float64(y * Float64(t * x)); elseif (z <= -3.3e-81) tmp = Float64(t * Float64(y * Float64(-z))); elseif (z <= 0.0032) tmp = Float64(x * Float64(t * y)); else tmp = t_1; end return tmp end
y, t = num2cell(sort([y, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = -(z * (t * y));
tmp = 0.0;
if (z <= -1.1e+90)
tmp = t_1;
elseif (z <= -7.6e+67)
tmp = y * (t * x);
elseif (z <= -3.3e-81)
tmp = t * (y * -z);
elseif (z <= 0.0032)
tmp = x * (t * y);
else
tmp = t_1;
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[(z * N[(t * y), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[z, -1.1e+90], t$95$1, If[LessEqual[z, -7.6e+67], N[(y * N[(t * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -3.3e-81], N[(t * N[(y * (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0032], N[(x * N[(t * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
\begin{array}{l}
t_1 := -z \cdot \left(t \cdot y\right)\\
\mathbf{if}\;z \leq -1.1 \cdot 10^{+90}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -7.6 \cdot 10^{+67}:\\
\;\;\;\;y \cdot \left(t \cdot x\right)\\
\mathbf{elif}\;z \leq -3.3 \cdot 10^{-81}:\\
\;\;\;\;t \cdot \left(y \cdot \left(-z\right)\right)\\
\mathbf{elif}\;z \leq 0.0032:\\
\;\;\;\;x \cdot \left(t \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -1.09999999999999995e90 or 0.00320000000000000015 < z Initial program 83.0%
distribute-rgt-out--86.4%
Simplified86.4%
Taylor expanded in x around 0 76.1%
mul-1-neg76.1%
distribute-rgt-neg-out76.1%
Simplified76.1%
distribute-rgt-neg-out76.1%
distribute-lft-neg-out76.1%
*-commutative76.1%
add-sqr-sqrt35.5%
sqrt-unprod23.1%
sqr-neg23.1%
sqrt-unprod0.5%
add-sqr-sqrt1.5%
associate-*l*1.7%
add-sqr-sqrt0.6%
sqrt-unprod24.4%
sqr-neg24.4%
sqrt-unprod39.6%
add-sqr-sqrt81.3%
Applied egg-rr81.3%
if -1.09999999999999995e90 < z < -7.60000000000000041e67Initial program 78.3%
distribute-rgt-out--89.4%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in x around inf 99.8%
if -7.60000000000000041e67 < z < -3.29999999999999987e-81Initial program 99.3%
distribute-rgt-out--99.3%
Simplified99.3%
Taylor expanded in x around 0 75.4%
mul-1-neg75.4%
distribute-rgt-neg-out75.4%
Simplified75.4%
if -3.29999999999999987e-81 < z < 0.00320000000000000015Initial program 91.4%
distribute-rgt-out--91.5%
associate-*l*89.7%
Simplified89.7%
Taylor expanded in x around inf 74.5%
add-log-exp29.4%
associate-*r*29.4%
exp-prod28.6%
Applied egg-rr28.6%
log-pow30.5%
rem-log-exp79.6%
Simplified79.6%
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 1e+48) (* y (* t (- x z))) (* t (* y (- x z)))))
assert(y < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1e+48) {
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 (t <= 1d+48) 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 (t <= 1e+48) {
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 t <= 1e+48: 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 (t <= 1e+48) 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 (t <= 1e+48)
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[t, 1e+48], 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}\;t \leq 10^{+48}:\\
\;\;\;\;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 t < 1.00000000000000004e48Initial program 87.4%
distribute-rgt-out--89.4%
associate-*l*92.8%
Simplified92.8%
if 1.00000000000000004e48 < t Initial program 93.9%
distribute-rgt-out--93.9%
Simplified93.9%
Final simplification93.0%
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -1.2e-74) (* x (* t y)) (* t (* y x))))
assert(y < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.2e-74) {
tmp = x * (t * y);
} 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 <= (-1.2d-74)) then
tmp = x * (t * y)
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 <= -1.2e-74) {
tmp = x * (t * y);
} else {
tmp = t * (y * x);
}
return tmp;
}
[y, t] = sort([y, t]) def code(x, y, z, t): tmp = 0 if y <= -1.2e-74: tmp = x * (t * y) else: tmp = t * (y * x) return tmp
y, t = sort([y, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -1.2e-74) tmp = Float64(x * Float64(t * y)); 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 <= -1.2e-74)
tmp = x * (t * y);
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, -1.2e-74], N[(x * N[(t * y), $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 -1.2 \cdot 10^{-74}:\\
\;\;\;\;x \cdot \left(t \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot x\right)\\
\end{array}
\end{array}
if y < -1.1999999999999999e-74Initial program 82.2%
distribute-rgt-out--84.7%
associate-*l*94.7%
Simplified94.7%
Taylor expanded in x around inf 46.3%
add-log-exp31.3%
associate-*r*31.3%
exp-prod30.6%
Applied egg-rr30.6%
log-pow33.4%
rem-log-exp52.5%
Simplified52.5%
if -1.1999999999999999e-74 < y Initial program 92.3%
distribute-rgt-out--93.5%
Simplified93.5%
Taylor expanded in x around inf 56.1%
Final simplification54.8%
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.6%
distribute-rgt-out--90.3%
associate-*l*89.4%
Simplified89.4%
Final simplification89.4%
NOTE: y and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* x (* t y)))
assert(y < t);
double code(double x, double y, double z, double t) {
return x * (t * y);
}
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 * (t * y)
end function
assert y < t;
public static double code(double x, double y, double z, double t) {
return x * (t * y);
}
[y, t] = sort([y, t]) def code(x, y, z, t): return x * (t * y)
y, t = sort([y, t]) function code(x, y, z, t) return Float64(x * Float64(t * y)) end
y, t = num2cell(sort([y, t])){:}
function tmp = code(x, y, z, t)
tmp = x * (t * y);
end
NOTE: y and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(x * N[(t * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, t] = \mathsf{sort}([y, t])\\
\\
x \cdot \left(t \cdot y\right)
\end{array}
Initial program 88.6%
distribute-rgt-out--90.3%
associate-*l*89.4%
Simplified89.4%
Taylor expanded in x around inf 51.8%
add-log-exp26.3%
associate-*r*26.3%
exp-prod25.9%
Applied egg-rr25.9%
log-pow27.5%
rem-log-exp54.3%
Simplified54.3%
Final simplification54.3%
(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 2023173
(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))