
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z) a)) (t_2 (- (* y x) (* t z))))
(if (<= t_2 (- INFINITY))
(fma t_1 t (* (/ x a) y))
(if (<= t_2 1e+285)
(/ (fma y x (* (- t) z)) a)
(fma (/ x a) y (* t_1 t))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -z / a;
double t_2 = (y * x) - (t * z);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(t_1, t, ((x / a) * y));
} else if (t_2 <= 1e+285) {
tmp = fma(y, x, (-t * z)) / a;
} else {
tmp = fma((x / a), y, (t_1 * t));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(-z) / a) t_2 = Float64(Float64(y * x) - Float64(t * z)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(t_1, t, Float64(Float64(x / a) * y)); elseif (t_2 <= 1e+285) tmp = Float64(fma(y, x, Float64(Float64(-t) * z)) / a); else tmp = fma(Float64(x / a), y, Float64(t_1 * t)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-z) / a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * x), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(t$95$1 * t + N[(N[(x / a), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+285], N[(N[(y * x + N[((-t) * z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(x / a), $MachinePrecision] * y + N[(t$95$1 * t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-z}{a}\\
t_2 := y \cdot x - t \cdot z\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(t\_1, t, \frac{x}{a} \cdot y\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+285}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(-t\right) \cdot z\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{a}, y, t\_1 \cdot t\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 57.1%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6457.1
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f6457.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6457.1
Applied rewrites57.1%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-rgt-inN/A
div-invN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l/N/A
lift-/.f64N/A
div-invN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
*-commutativeN/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
Applied rewrites99.9%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 9.9999999999999998e284Initial program 98.6%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6498.6
Applied rewrites98.6%
if 9.9999999999999998e284 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 69.2%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6497.2
Applied rewrites97.2%
Final simplification98.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ x a) y (* (/ (- z) a) t))) (t_2 (- (* y x) (* t z))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 1e+285) (/ (fma y x (* (- t) z)) a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((x / a), y, ((-z / a) * t));
double t_2 = (y * x) - (t * z);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 1e+285) {
tmp = fma(y, x, (-t * z)) / a;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(x / a), y, Float64(Float64(Float64(-z) / a) * t)) t_2 = Float64(Float64(y * x) - Float64(t * z)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 1e+285) tmp = Float64(fma(y, x, Float64(Float64(-t) * z)) / a); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x / a), $MachinePrecision] * y + N[(N[((-z) / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * x), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 1e+285], N[(N[(y * x + N[((-t) * z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x}{a}, y, \frac{-z}{a} \cdot t\right)\\
t_2 := y \cdot x - t \cdot z\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+285}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(-t\right) \cdot z\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0 or 9.9999999999999998e284 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 64.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6496.5
Applied rewrites96.5%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 9.9999999999999998e284Initial program 98.6%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6498.6
Applied rewrites98.6%
Final simplification98.1%
(FPCore (x y z t a)
:precision binary64
(if (<= (* t z) -5e-22)
(* (/ (- z) a) t)
(if (<= (* t z) 1e-17)
(/ (* y x) a)
(if (<= (* t z) 1e+90) (/ (* (- t) z) a) (* (/ (- t) a) z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t * z) <= -5e-22) {
tmp = (-z / a) * t;
} else if ((t * z) <= 1e-17) {
tmp = (y * x) / a;
} else if ((t * z) <= 1e+90) {
tmp = (-t * z) / a;
} else {
tmp = (-t / a) * z;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t * z) <= (-5d-22)) then
tmp = (-z / a) * t
else if ((t * z) <= 1d-17) then
tmp = (y * x) / a
else if ((t * z) <= 1d+90) then
tmp = (-t * z) / a
else
tmp = (-t / a) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t * z) <= -5e-22) {
tmp = (-z / a) * t;
} else if ((t * z) <= 1e-17) {
tmp = (y * x) / a;
} else if ((t * z) <= 1e+90) {
tmp = (-t * z) / a;
} else {
tmp = (-t / a) * z;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t * z) <= -5e-22: tmp = (-z / a) * t elif (t * z) <= 1e-17: tmp = (y * x) / a elif (t * z) <= 1e+90: tmp = (-t * z) / a else: tmp = (-t / a) * z return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(t * z) <= -5e-22) tmp = Float64(Float64(Float64(-z) / a) * t); elseif (Float64(t * z) <= 1e-17) tmp = Float64(Float64(y * x) / a); elseif (Float64(t * z) <= 1e+90) tmp = Float64(Float64(Float64(-t) * z) / a); else tmp = Float64(Float64(Float64(-t) / a) * z); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t * z) <= -5e-22) tmp = (-z / a) * t; elseif ((t * z) <= 1e-17) tmp = (y * x) / a; elseif ((t * z) <= 1e+90) tmp = (-t * z) / a; else tmp = (-t / a) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(t * z), $MachinePrecision], -5e-22], N[(N[((-z) / a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 1e-17], N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 1e+90], N[(N[((-t) * z), $MachinePrecision] / a), $MachinePrecision], N[(N[((-t) / a), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -5 \cdot 10^{-22}:\\
\;\;\;\;\frac{-z}{a} \cdot t\\
\mathbf{elif}\;t \cdot z \leq 10^{-17}:\\
\;\;\;\;\frac{y \cdot x}{a}\\
\mathbf{elif}\;t \cdot z \leq 10^{+90}:\\
\;\;\;\;\frac{\left(-t\right) \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t}{a} \cdot z\\
\end{array}
\end{array}
if (*.f64 z t) < -4.99999999999999954e-22Initial program 86.0%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6481.3
Applied rewrites81.3%
if -4.99999999999999954e-22 < (*.f64 z t) < 1.00000000000000007e-17Initial program 95.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6476.5
Applied rewrites76.5%
if 1.00000000000000007e-17 < (*.f64 z t) < 9.99999999999999966e89Initial program 99.8%
Taylor expanded in t around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6469.3
Applied rewrites69.3%
if 9.99999999999999966e89 < (*.f64 z t) Initial program 82.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6419.0
Applied rewrites19.0%
Taylor expanded in t around inf
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6486.7
Applied rewrites86.7%
Final simplification78.9%
(FPCore (x y z t a) :precision binary64 (if (<= (* t z) (- INFINITY)) (* (/ (- z) a) t) (if (<= (* t z) 1e+248) (/ (fma y x (* (- t) z)) a) (* (/ (- t) a) z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t * z) <= -((double) INFINITY)) {
tmp = (-z / a) * t;
} else if ((t * z) <= 1e+248) {
tmp = fma(y, x, (-t * z)) / a;
} else {
tmp = (-t / a) * z;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (Float64(t * z) <= Float64(-Inf)) tmp = Float64(Float64(Float64(-z) / a) * t); elseif (Float64(t * z) <= 1e+248) tmp = Float64(fma(y, x, Float64(Float64(-t) * z)) / a); else tmp = Float64(Float64(Float64(-t) / a) * z); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(t * z), $MachinePrecision], (-Infinity)], N[(N[((-z) / a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 1e+248], N[(N[(y * x + N[((-t) * z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[((-t) / a), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -\infty:\\
\;\;\;\;\frac{-z}{a} \cdot t\\
\mathbf{elif}\;t \cdot z \leq 10^{+248}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(-t\right) \cdot z\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t}{a} \cdot z\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 68.4%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6492.2
Applied rewrites92.2%
if -inf.0 < (*.f64 z t) < 1.00000000000000005e248Initial program 95.7%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6495.7
Applied rewrites95.7%
if 1.00000000000000005e248 < (*.f64 z t) Initial program 62.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6413.2
Applied rewrites13.2%
Taylor expanded in t around inf
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6488.9
Applied rewrites88.9%
Final simplification94.9%
(FPCore (x y z t a) :precision binary64 (if (<= (* t z) (- INFINITY)) (* (/ (- z) a) t) (if (<= (* t z) 1e+248) (/ (- (* y x) (* t z)) a) (* (/ (- t) a) z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t * z) <= -((double) INFINITY)) {
tmp = (-z / a) * t;
} else if ((t * z) <= 1e+248) {
tmp = ((y * x) - (t * z)) / a;
} else {
tmp = (-t / a) * z;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t * z) <= -Double.POSITIVE_INFINITY) {
tmp = (-z / a) * t;
} else if ((t * z) <= 1e+248) {
tmp = ((y * x) - (t * z)) / a;
} else {
tmp = (-t / a) * z;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t * z) <= -math.inf: tmp = (-z / a) * t elif (t * z) <= 1e+248: tmp = ((y * x) - (t * z)) / a else: tmp = (-t / a) * z return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(t * z) <= Float64(-Inf)) tmp = Float64(Float64(Float64(-z) / a) * t); elseif (Float64(t * z) <= 1e+248) tmp = Float64(Float64(Float64(y * x) - Float64(t * z)) / a); else tmp = Float64(Float64(Float64(-t) / a) * z); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t * z) <= -Inf) tmp = (-z / a) * t; elseif ((t * z) <= 1e+248) tmp = ((y * x) - (t * z)) / a; else tmp = (-t / a) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(t * z), $MachinePrecision], (-Infinity)], N[(N[((-z) / a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 1e+248], N[(N[(N[(y * x), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[((-t) / a), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -\infty:\\
\;\;\;\;\frac{-z}{a} \cdot t\\
\mathbf{elif}\;t \cdot z \leq 10^{+248}:\\
\;\;\;\;\frac{y \cdot x - t \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t}{a} \cdot z\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 68.4%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6492.2
Applied rewrites92.2%
if -inf.0 < (*.f64 z t) < 1.00000000000000005e248Initial program 95.7%
if 1.00000000000000005e248 < (*.f64 z t) Initial program 62.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6413.2
Applied rewrites13.2%
Taylor expanded in t around inf
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6488.9
Applied rewrites88.9%
Final simplification94.9%
(FPCore (x y z t a) :precision binary64 (if (<= (* t z) -5e-22) (* (/ (- z) a) t) (if (<= (* t z) 1e-17) (/ (* y x) a) (* (/ (- t) a) z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t * z) <= -5e-22) {
tmp = (-z / a) * t;
} else if ((t * z) <= 1e-17) {
tmp = (y * x) / a;
} else {
tmp = (-t / a) * z;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t * z) <= (-5d-22)) then
tmp = (-z / a) * t
else if ((t * z) <= 1d-17) then
tmp = (y * x) / a
else
tmp = (-t / a) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t * z) <= -5e-22) {
tmp = (-z / a) * t;
} else if ((t * z) <= 1e-17) {
tmp = (y * x) / a;
} else {
tmp = (-t / a) * z;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t * z) <= -5e-22: tmp = (-z / a) * t elif (t * z) <= 1e-17: tmp = (y * x) / a else: tmp = (-t / a) * z return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(t * z) <= -5e-22) tmp = Float64(Float64(Float64(-z) / a) * t); elseif (Float64(t * z) <= 1e-17) tmp = Float64(Float64(y * x) / a); else tmp = Float64(Float64(Float64(-t) / a) * z); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t * z) <= -5e-22) tmp = (-z / a) * t; elseif ((t * z) <= 1e-17) tmp = (y * x) / a; else tmp = (-t / a) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(t * z), $MachinePrecision], -5e-22], N[(N[((-z) / a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 1e-17], N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision], N[(N[((-t) / a), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -5 \cdot 10^{-22}:\\
\;\;\;\;\frac{-z}{a} \cdot t\\
\mathbf{elif}\;t \cdot z \leq 10^{-17}:\\
\;\;\;\;\frac{y \cdot x}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t}{a} \cdot z\\
\end{array}
\end{array}
if (*.f64 z t) < -4.99999999999999954e-22Initial program 86.0%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6481.3
Applied rewrites81.3%
if -4.99999999999999954e-22 < (*.f64 z t) < 1.00000000000000007e-17Initial program 95.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6476.5
Applied rewrites76.5%
if 1.00000000000000007e-17 < (*.f64 z t) Initial program 87.5%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6423.6
Applied rewrites23.6%
Taylor expanded in t around inf
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6472.2
Applied rewrites72.2%
Final simplification76.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ (- z) a) t))) (if (<= (* t z) -5e-22) t_1 (if (<= (* t z) 1e-17) (/ (* y x) a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (-z / a) * t;
double tmp;
if ((t * z) <= -5e-22) {
tmp = t_1;
} else if ((t * z) <= 1e-17) {
tmp = (y * x) / a;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (-z / a) * t
if ((t * z) <= (-5d-22)) then
tmp = t_1
else if ((t * z) <= 1d-17) then
tmp = (y * x) / a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (-z / a) * t;
double tmp;
if ((t * z) <= -5e-22) {
tmp = t_1;
} else if ((t * z) <= 1e-17) {
tmp = (y * x) / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (-z / a) * t tmp = 0 if (t * z) <= -5e-22: tmp = t_1 elif (t * z) <= 1e-17: tmp = (y * x) / a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(-z) / a) * t) tmp = 0.0 if (Float64(t * z) <= -5e-22) tmp = t_1; elseif (Float64(t * z) <= 1e-17) tmp = Float64(Float64(y * x) / a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (-z / a) * t; tmp = 0.0; if ((t * z) <= -5e-22) tmp = t_1; elseif ((t * z) <= 1e-17) tmp = (y * x) / a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[((-z) / a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[N[(t * z), $MachinePrecision], -5e-22], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], 1e-17], N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-z}{a} \cdot t\\
\mathbf{if}\;t \cdot z \leq -5 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \cdot z \leq 10^{-17}:\\
\;\;\;\;\frac{y \cdot x}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -4.99999999999999954e-22 or 1.00000000000000007e-17 < (*.f64 z t) Initial program 86.7%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6478.3
Applied rewrites78.3%
if -4.99999999999999954e-22 < (*.f64 z t) < 1.00000000000000007e-17Initial program 95.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6476.5
Applied rewrites76.5%
Final simplification77.4%
(FPCore (x y z t a) :precision binary64 (if (<= y 1.52e+117) (* (/ x a) y) (* (/ y a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 1.52e+117) {
tmp = (x / a) * y;
} else {
tmp = (y / a) * x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= 1.52d+117) then
tmp = (x / a) * y
else
tmp = (y / a) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 1.52e+117) {
tmp = (x / a) * y;
} else {
tmp = (y / a) * x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= 1.52e+117: tmp = (x / a) * y else: tmp = (y / a) * x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= 1.52e+117) tmp = Float64(Float64(x / a) * y); else tmp = Float64(Float64(y / a) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= 1.52e+117) tmp = (x / a) * y; else tmp = (y / a) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, 1.52e+117], N[(N[(x / a), $MachinePrecision] * y), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.52 \cdot 10^{+117}:\\
\;\;\;\;\frac{x}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot x\\
\end{array}
\end{array}
if y < 1.52e117Initial program 91.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6441.7
Applied rewrites41.7%
Taylor expanded in t around 0
associate-*l/N/A
lower-*.f64N/A
lower-/.f6443.0
Applied rewrites43.0%
if 1.52e117 < y Initial program 84.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6475.8
Applied rewrites75.8%
Taylor expanded in t around 0
associate-*l/N/A
lower-*.f64N/A
lower-/.f6464.6
Applied rewrites64.6%
Applied rewrites82.3%
(FPCore (x y z t a) :precision binary64 (* (/ x a) y))
double code(double x, double y, double z, double t, double a) {
return (x / a) * y;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (x / a) * y
end function
public static double code(double x, double y, double z, double t, double a) {
return (x / a) * y;
}
def code(x, y, z, t, a): return (x / a) * y
function code(x, y, z, t, a) return Float64(Float64(x / a) * y) end
function tmp = code(x, y, z, t, a) tmp = (x / a) * y; end
code[x_, y_, z_, t_, a_] := N[(N[(x / a), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{a} \cdot y
\end{array}
Initial program 90.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6446.0
Applied rewrites46.0%
Taylor expanded in t around 0
associate-*l/N/A
lower-*.f64N/A
lower-/.f6445.7
Applied rewrites45.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* (/ y a) x) (* (/ t a) z))))
(if (< z -2.468684968699548e+170)
t_1
(if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = ((y / a) * x) - ((t / a) * z)
if (z < (-2.468684968699548d+170)) then
tmp = t_1
else if (z < 6.309831121978371d-71) then
tmp = ((x * y) - (z * t)) / a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((y / a) * x) - ((t / a) * z) tmp = 0 if z < -2.468684968699548e+170: tmp = t_1 elif z < 6.309831121978371e-71: tmp = ((x * y) - (z * t)) / a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y / a) * x) - Float64(Float64(t / a) * z)) tmp = 0.0 if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((y / a) * x) - ((t / a) * z); tmp = 0.0; if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = ((x * y) - (z * t)) / a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -2.468684968699548e+170], t$95$1, If[Less[z, 6.309831121978371e-71], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\
\mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024268
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:alt
(! :herbie-platform default (if (< z -246868496869954800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6309831121978371/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z)))))
(/ (- (* x y) (* z t)) a))