
(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}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- (* x y) (* y z)) t)))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+303)))
(* y (* t (- x z)))
(fma (* y (- x z)) t (* t (fma y (- z) (* y z)))))))
double code(double x, double y, double z, double t) {
double t_1 = ((x * y) - (y * z)) * t;
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 5e+303)) {
tmp = y * (t * (x - z));
} else {
tmp = fma((y * (x - z)), t, (t * fma(y, -z, (y * z))));
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(Float64(x * y) - Float64(y * z)) * t) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 5e+303)) tmp = Float64(y * Float64(t * Float64(x - z))); else tmp = fma(Float64(y * Float64(x - z)), t, Float64(t * fma(y, Float64(-z), Float64(y * z)))); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(x * y), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+303]], $MachinePrecision]], N[(y * N[(t * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(x - z), $MachinePrecision]), $MachinePrecision] * t + N[(t * N[(y * (-z) + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot y - y \cdot z\right) \cdot t\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 5 \cdot 10^{+303}\right):\\
\;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(x - z\right), t, t \cdot \mathsf{fma}\left(y, -z, y \cdot z\right)\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 (*.f64 x y) (*.f64 z y)) t) < -inf.0 or 4.9999999999999997e303 < (*.f64 (-.f64 (*.f64 x y) (*.f64 z y)) t) Initial program 73.0%
distribute-rgt-out--78.6%
associate-*l*100.0%
Simplified100.0%
if -inf.0 < (*.f64 (-.f64 (*.f64 x y) (*.f64 z y)) t) < 4.9999999999999997e303Initial program 98.0%
distribute-rgt-out--98.0%
associate-*l*85.2%
Simplified85.2%
associate-*r*98.0%
distribute-rgt-out--98.0%
*-commutative98.0%
prod-diff98.0%
*-commutative98.0%
fma-neg98.0%
distribute-rgt-in98.1%
fma-def98.2%
distribute-rgt-out--98.2%
*-commutative98.2%
fma-udef98.0%
distribute-lft-neg-in98.0%
distribute-rgt-neg-in98.0%
fma-def98.2%
*-commutative98.2%
Applied egg-rr98.2%
Final simplification98.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x y) (* y z))))
(if (<= t_1 -1e+298)
(* y (* t (- x z)))
(if (<= t_1 1e+174) (* t_1 t) (* y (/ t (/ 1.0 (- x z))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * y) - (y * z);
double tmp;
if (t_1 <= -1e+298) {
tmp = y * (t * (x - z));
} else if (t_1 <= 1e+174) {
tmp = t_1 * t;
} else {
tmp = y * (t / (1.0 / (x - z)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) - (y * z)
if (t_1 <= (-1d+298)) then
tmp = y * (t * (x - z))
else if (t_1 <= 1d+174) then
tmp = t_1 * t
else
tmp = y * (t / (1.0d0 / (x - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * y) - (y * z);
double tmp;
if (t_1 <= -1e+298) {
tmp = y * (t * (x - z));
} else if (t_1 <= 1e+174) {
tmp = t_1 * t;
} else {
tmp = y * (t / (1.0 / (x - z)));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * y) - (y * z) tmp = 0 if t_1 <= -1e+298: tmp = y * (t * (x - z)) elif t_1 <= 1e+174: tmp = t_1 * t else: tmp = y * (t / (1.0 / (x - z))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * y) - Float64(y * z)) tmp = 0.0 if (t_1 <= -1e+298) tmp = Float64(y * Float64(t * Float64(x - z))); elseif (t_1 <= 1e+174) tmp = Float64(t_1 * t); else tmp = Float64(y * Float64(t / Float64(1.0 / Float64(x - z)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * y) - (y * z); tmp = 0.0; if (t_1 <= -1e+298) tmp = y * (t * (x - z)); elseif (t_1 <= 1e+174) tmp = t_1 * t; else tmp = y * (t / (1.0 / (x - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+298], N[(y * N[(t * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+174], N[(t$95$1 * t), $MachinePrecision], N[(y * N[(t / N[(1.0 / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y - y \cdot z\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{+298}:\\
\;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\
\mathbf{elif}\;t_1 \leq 10^{+174}:\\
\;\;\;\;t_1 \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{t}{\frac{1}{x - z}}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z y)) < -9.9999999999999996e297Initial program 61.5%
distribute-rgt-out--61.5%
associate-*l*99.9%
Simplified99.9%
if -9.9999999999999996e297 < (-.f64 (*.f64 x y) (*.f64 z y)) < 1.00000000000000007e174Initial program 98.1%
if 1.00000000000000007e174 < (-.f64 (*.f64 x y) (*.f64 z y)) Initial program 76.4%
distribute-rgt-out--85.5%
associate-*l*99.8%
Simplified99.8%
*-commutative99.8%
flip--58.1%
associate-*r/58.1%
Applied egg-rr58.1%
associate-/l*58.1%
difference-of-squares68.9%
associate-/r*99.8%
*-inverses99.8%
Simplified99.8%
Final simplification98.6%
(FPCore (x y z t) :precision binary64 (if (<= x -2.45e-37) (* x (* y t)) (if (<= x 1e-18) (- (* y (* z t))) (* y (* x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.45e-37) {
tmp = x * (y * t);
} else if (x <= 1e-18) {
tmp = -(y * (z * t));
} else {
tmp = y * (x * 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 (x <= (-2.45d-37)) then
tmp = x * (y * t)
else if (x <= 1d-18) then
tmp = -(y * (z * t))
else
tmp = y * (x * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.45e-37) {
tmp = x * (y * t);
} else if (x <= 1e-18) {
tmp = -(y * (z * t));
} else {
tmp = y * (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.45e-37: tmp = x * (y * t) elif x <= 1e-18: tmp = -(y * (z * t)) else: tmp = y * (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.45e-37) tmp = Float64(x * Float64(y * t)); elseif (x <= 1e-18) tmp = Float64(-Float64(y * Float64(z * t))); else tmp = Float64(y * Float64(x * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.45e-37) tmp = x * (y * t); elseif (x <= 1e-18) tmp = -(y * (z * t)); else tmp = y * (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.45e-37], N[(x * N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1e-18], (-N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), N[(y * N[(x * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.45 \cdot 10^{-37}:\\
\;\;\;\;x \cdot \left(y \cdot t\right)\\
\mathbf{elif}\;x \leq 10^{-18}:\\
\;\;\;\;-y \cdot \left(z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot t\right)\\
\end{array}
\end{array}
if x < -2.45000000000000009e-37Initial program 88.1%
distribute-rgt-out--92.1%
associate-*l*89.5%
Simplified89.5%
associate-*r*92.1%
distribute-rgt-out--88.1%
*-commutative88.1%
prod-diff88.0%
*-commutative88.0%
fma-neg88.0%
distribute-rgt-in85.3%
fma-def85.4%
distribute-rgt-out--86.7%
*-commutative86.7%
fma-udef88.0%
distribute-lft-neg-in88.0%
distribute-rgt-neg-in88.0%
fma-def86.7%
*-commutative86.7%
Applied egg-rr86.7%
Taylor expanded in z around 0 81.3%
Taylor expanded in z around 0 72.0%
associate-*r*74.6%
Simplified74.6%
if -2.45000000000000009e-37 < x < 1.0000000000000001e-18Initial program 95.4%
distribute-rgt-out--95.4%
associate-*l*90.6%
Simplified90.6%
Taylor expanded in x around 0 75.5%
associate-*r*75.5%
neg-mul-175.5%
Simplified75.5%
if 1.0000000000000001e-18 < x Initial program 86.3%
distribute-rgt-out--87.9%
associate-*l*87.8%
Simplified87.8%
Taylor expanded in x around inf 74.5%
Final simplification75.0%
(FPCore (x y z t) :precision binary64 (if (<= x -3.1e-36) (* x (* y t)) (if (<= x 8.2e-15) (* t (* y (- z))) (* y (* x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.1e-36) {
tmp = x * (y * t);
} else if (x <= 8.2e-15) {
tmp = t * (y * -z);
} else {
tmp = y * (x * 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 (x <= (-3.1d-36)) then
tmp = x * (y * t)
else if (x <= 8.2d-15) then
tmp = t * (y * -z)
else
tmp = y * (x * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.1e-36) {
tmp = x * (y * t);
} else if (x <= 8.2e-15) {
tmp = t * (y * -z);
} else {
tmp = y * (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.1e-36: tmp = x * (y * t) elif x <= 8.2e-15: tmp = t * (y * -z) else: tmp = y * (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.1e-36) tmp = Float64(x * Float64(y * t)); elseif (x <= 8.2e-15) tmp = Float64(t * Float64(y * Float64(-z))); else tmp = Float64(y * Float64(x * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.1e-36) tmp = x * (y * t); elseif (x <= 8.2e-15) tmp = t * (y * -z); else tmp = y * (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.1e-36], N[(x * N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.2e-15], N[(t * N[(y * (-z)), $MachinePrecision]), $MachinePrecision], N[(y * N[(x * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{-36}:\\
\;\;\;\;x \cdot \left(y \cdot t\right)\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{-15}:\\
\;\;\;\;t \cdot \left(y \cdot \left(-z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot t\right)\\
\end{array}
\end{array}
if x < -3.0999999999999999e-36Initial program 88.1%
distribute-rgt-out--92.1%
associate-*l*89.5%
Simplified89.5%
associate-*r*92.1%
distribute-rgt-out--88.1%
*-commutative88.1%
prod-diff88.0%
*-commutative88.0%
fma-neg88.0%
distribute-rgt-in85.3%
fma-def85.4%
distribute-rgt-out--86.7%
*-commutative86.7%
fma-udef88.0%
distribute-lft-neg-in88.0%
distribute-rgt-neg-in88.0%
fma-def86.7%
*-commutative86.7%
Applied egg-rr86.7%
Taylor expanded in z around 0 81.3%
Taylor expanded in z around 0 72.0%
associate-*r*74.6%
Simplified74.6%
if -3.0999999999999999e-36 < x < 8.20000000000000072e-15Initial program 95.4%
distribute-rgt-out--95.4%
Simplified95.4%
Taylor expanded in x around 0 79.7%
neg-mul-179.7%
distribute-lft-neg-in79.7%
Simplified79.7%
if 8.20000000000000072e-15 < x Initial program 86.3%
distribute-rgt-out--87.9%
associate-*l*87.8%
Simplified87.8%
Taylor expanded in x around inf 74.5%
Final simplification76.8%
(FPCore (x y z t) :precision binary64 (if (<= t 700000000000.0) (* y (* t (- x z))) (* t (* y (- x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 700000000000.0) {
tmp = y * (t * (x - z));
} else {
tmp = t * (y * (x - z));
}
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 <= 700000000000.0d0) then
tmp = y * (t * (x - z))
else
tmp = t * (y * (x - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 700000000000.0) {
tmp = y * (t * (x - z));
} else {
tmp = t * (y * (x - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 700000000000.0: tmp = y * (t * (x - z)) else: tmp = t * (y * (x - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 700000000000.0) tmp = Float64(y * Float64(t * Float64(x - z))); else tmp = Float64(t * Float64(y * Float64(x - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 700000000000.0) tmp = y * (t * (x - z)); else tmp = t * (y * (x - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 700000000000.0], N[(y * N[(t * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(y * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 700000000000:\\
\;\;\;\;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 < 7e11Initial program 87.7%
distribute-rgt-out--90.0%
associate-*l*90.5%
Simplified90.5%
if 7e11 < t Initial program 98.5%
distribute-rgt-out--98.5%
Simplified98.5%
Final simplification92.8%
(FPCore (x y z t) :precision binary64 (if (<= t 1.65e-72) (* y (* x t)) (* x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.65e-72) {
tmp = y * (x * t);
} else {
tmp = x * (y * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 1.65d-72) then
tmp = y * (x * t)
else
tmp = x * (y * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.65e-72) {
tmp = y * (x * t);
} else {
tmp = x * (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.65e-72: tmp = y * (x * t) else: tmp = x * (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.65e-72) tmp = Float64(y * Float64(x * t)); else tmp = Float64(x * Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 1.65e-72) tmp = y * (x * t); else tmp = x * (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.65e-72], N[(y * N[(x * t), $MachinePrecision]), $MachinePrecision], N[(x * N[(y * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.65 \cdot 10^{-72}:\\
\;\;\;\;y \cdot \left(x \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot t\right)\\
\end{array}
\end{array}
if t < 1.65e-72Initial program 86.7%
distribute-rgt-out--89.2%
associate-*l*89.4%
Simplified89.4%
Taylor expanded in x around inf 55.6%
if 1.65e-72 < t Initial program 97.8%
distribute-rgt-out--97.8%
associate-*l*89.7%
Simplified89.7%
associate-*r*97.8%
distribute-rgt-out--97.8%
*-commutative97.8%
prod-diff90.3%
*-commutative90.3%
fma-neg90.3%
distribute-rgt-in82.8%
fma-def83.0%
distribute-rgt-out--83.0%
*-commutative83.0%
fma-udef90.3%
distribute-lft-neg-in90.3%
distribute-rgt-neg-in90.3%
fma-def83.0%
*-commutative83.0%
Applied egg-rr83.0%
Taylor expanded in z around 0 88.7%
Taylor expanded in z around 0 50.6%
associate-*r*55.7%
Simplified55.7%
Final simplification55.6%
(FPCore (x y z t) :precision binary64 (* y (* t (- x z))))
double code(double x, double y, double z, double t) {
return y * (t * (x - z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = y * (t * (x - z))
end function
public static double code(double x, double y, double z, double t) {
return y * (t * (x - z));
}
def code(x, y, z, t): return y * (t * (x - z))
function code(x, y, z, t) return Float64(y * Float64(t * Float64(x - z))) end
function tmp = code(x, y, z, t) tmp = y * (t * (x - z)); end
code[x_, y_, z_, t_] := N[(y * N[(t * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(t \cdot \left(x - z\right)\right)
\end{array}
Initial program 90.8%
distribute-rgt-out--92.4%
associate-*l*89.5%
Simplified89.5%
Final simplification89.5%
(FPCore (x y z t) :precision binary64 (* y (* x t)))
double code(double x, double y, double z, double t) {
return y * (x * t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = y * (x * t)
end function
public static double code(double x, double y, double z, double t) {
return y * (x * t);
}
def code(x, y, z, t): return y * (x * t)
function code(x, y, z, t) return Float64(y * Float64(x * t)) end
function tmp = code(x, y, z, t) tmp = y * (x * t); end
code[x_, y_, z_, t_] := N[(y * N[(x * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(x \cdot t\right)
\end{array}
Initial program 90.8%
distribute-rgt-out--92.4%
associate-*l*89.5%
Simplified89.5%
Taylor expanded in x around inf 53.8%
Final simplification53.8%
(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 2023230
(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))