
(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 10 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)) (t_2 (- (* y x) (* t z))))
(if (<= t_2 (- INFINITY))
(fma (/ y a) x t_1)
(if (<= t_2 1e+280) (/ t_2 a) (fma (/ -1.0 (/ a x)) (- y) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (-z / a) * t;
double t_2 = (y * x) - (t * z);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma((y / a), x, t_1);
} else if (t_2 <= 1e+280) {
tmp = t_2 / a;
} else {
tmp = fma((-1.0 / (a / x)), -y, t_1);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(-z) / a) * t) t_2 = Float64(Float64(y * x) - Float64(t * z)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(Float64(y / a), x, t_1); elseif (t_2 <= 1e+280) tmp = Float64(t_2 / a); else tmp = fma(Float64(-1.0 / Float64(a / x)), Float64(-y), t_1); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[((-z) / a), $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * x), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(y / a), $MachinePrecision] * x + t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 1e+280], N[(t$95$2 / a), $MachinePrecision], N[(N[(-1.0 / N[(a / x), $MachinePrecision]), $MachinePrecision] * (-y) + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-z}{a} \cdot t\\
t_2 := y \cdot x - t \cdot z\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, x, t\_1\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+280}:\\
\;\;\;\;\frac{t\_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{\frac{a}{x}}, -y, t\_1\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 58.2%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negN/A
lift-*.f64N/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.3
Applied rewrites96.3%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e280Initial program 99.0%
if 1e280 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 77.8%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-/.f6480.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.4
Applied rewrites80.4%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6480.4
Applied rewrites80.4%
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
associate-/r/N/A
lower-fma.f64N/A
frac-2negN/A
metadata-evalN/A
lift-/.f64N/A
distribute-neg-frac2N/A
distribute-frac-negN/A
frac-2negN/A
lift-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
un-div-invN/A
lift-/.f64N/A
Applied rewrites100.0%
Final simplification98.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ y a) x)) (t_2 (/ (- (* y x) (* t z)) a))) (if (<= t_2 -5e+261) t_1 (if (<= t_2 4e+301) (/ (* y x) a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * x;
double t_2 = ((y * x) - (t * z)) / a;
double tmp;
if (t_2 <= -5e+261) {
tmp = t_1;
} else if (t_2 <= 4e+301) {
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) :: t_2
real(8) :: tmp
t_1 = (y / a) * x
t_2 = ((y * x) - (t * z)) / a
if (t_2 <= (-5d+261)) then
tmp = t_1
else if (t_2 <= 4d+301) 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 = (y / a) * x;
double t_2 = ((y * x) - (t * z)) / a;
double tmp;
if (t_2 <= -5e+261) {
tmp = t_1;
} else if (t_2 <= 4e+301) {
tmp = (y * x) / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * x t_2 = ((y * x) - (t * z)) / a tmp = 0 if t_2 <= -5e+261: tmp = t_1 elif t_2 <= 4e+301: tmp = (y * x) / a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * x) t_2 = Float64(Float64(Float64(y * x) - Float64(t * z)) / a) tmp = 0.0 if (t_2 <= -5e+261) tmp = t_1; elseif (t_2 <= 4e+301) 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 = (y / a) * x; t_2 = ((y * x) - (t * z)) / a; tmp = 0.0; if (t_2 <= -5e+261) tmp = t_1; elseif (t_2 <= 4e+301) 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[(y / a), $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(y * x), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+261], t$95$1, If[LessEqual[t$95$2, 4e+301], N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot x\\
t_2 := \frac{y \cdot x - t \cdot z}{a}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+261}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+301}:\\
\;\;\;\;\frac{y \cdot x}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) < -5.0000000000000001e261 or 4.00000000000000021e301 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) Initial program 79.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6446.8
Applied rewrites46.8%
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.f6451.5
Applied rewrites51.5%
Taylor expanded in t around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6457.8
Applied rewrites57.8%
if -5.0000000000000001e261 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) < 4.00000000000000021e301Initial program 98.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6452.8
Applied rewrites52.8%
Final simplification54.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ y a) x (* (/ (- z) a) t))) (t_2 (- (* y x) (* t z)))) (if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 1e+249) (/ t_2 a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y / a), x, ((-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+249) {
tmp = t_2 / a;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y / a), x, 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+249) tmp = Float64(t_2 / a); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * x + 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+249], N[(t$95$2 / a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{a}, x, \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^{+249}:\\
\;\;\;\;\frac{t\_2}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0 or 9.9999999999999992e248 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 72.3%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negN/A
lift-*.f64N/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-/.f6498.4
Applied rewrites98.4%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 9.9999999999999992e248Initial program 98.9%
Final simplification98.8%
(FPCore (x y z t a) :precision binary64 (if (<= (- (* y x) (* t z)) (- INFINITY)) (* (/ (- (* (/ x z) y) t) a) z) (/ (fma y x (* (- z) t)) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((y * x) - (t * z)) <= -((double) INFINITY)) {
tmp = ((((x / z) * y) - t) / a) * z;
} else {
tmp = fma(y, x, (-z * t)) / a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(y * x) - Float64(t * z)) <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(Float64(x / z) * y) - t) / a) * z); else tmp = Float64(fma(y, x, Float64(Float64(-z) * t)) / a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(y * x), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(N[(N[(N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision] / a), $MachinePrecision] * z), $MachinePrecision], N[(N[(y * x + N[((-z) * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot x - t \cdot z \leq -\infty:\\
\;\;\;\;\frac{\frac{x}{z} \cdot y - t}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(-z\right) \cdot t\right)}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 58.2%
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-/.f6452.6
Applied rewrites52.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6489.2
Applied rewrites89.2%
Applied rewrites82.5%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 95.8%
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.f6496.3
Applied rewrites96.3%
Final simplification94.8%
(FPCore (x y z t a) :precision binary64 (if (<= (* t z) -2e+19) (* (/ -1.0 a) (* t z)) (if (<= (* t z) 400000.0) (/ (* y x) a) (/ (- z) (/ a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t * z) <= -2e+19) {
tmp = (-1.0 / a) * (t * z);
} else if ((t * z) <= 400000.0) {
tmp = (y * x) / a;
} else {
tmp = -z / (a / t);
}
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) <= (-2d+19)) then
tmp = ((-1.0d0) / a) * (t * z)
else if ((t * z) <= 400000.0d0) then
tmp = (y * x) / a
else
tmp = -z / (a / t)
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) <= -2e+19) {
tmp = (-1.0 / a) * (t * z);
} else if ((t * z) <= 400000.0) {
tmp = (y * x) / a;
} else {
tmp = -z / (a / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t * z) <= -2e+19: tmp = (-1.0 / a) * (t * z) elif (t * z) <= 400000.0: tmp = (y * x) / a else: tmp = -z / (a / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(t * z) <= -2e+19) tmp = Float64(Float64(-1.0 / a) * Float64(t * z)); elseif (Float64(t * z) <= 400000.0) tmp = Float64(Float64(y * x) / a); else tmp = Float64(Float64(-z) / Float64(a / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t * z) <= -2e+19) tmp = (-1.0 / a) * (t * z); elseif ((t * z) <= 400000.0) tmp = (y * x) / a; else tmp = -z / (a / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(t * z), $MachinePrecision], -2e+19], N[(N[(-1.0 / a), $MachinePrecision] * N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 400000.0], N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision], N[((-z) / N[(a / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -2 \cdot 10^{+19}:\\
\;\;\;\;\frac{-1}{a} \cdot \left(t \cdot z\right)\\
\mathbf{elif}\;t \cdot z \leq 400000:\\
\;\;\;\;\frac{y \cdot x}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-z}{\frac{a}{t}}\\
\end{array}
\end{array}
if (*.f64 z t) < -2e19Initial program 95.0%
lift-/.f64N/A
frac-2negN/A
div-invN/A
lower-*.f64N/A
lift--.f64N/A
sub-negN/A
distribute-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
remove-double-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6495.0
Applied rewrites95.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6473.0
Applied rewrites73.0%
if -2e19 < (*.f64 z t) < 4e5Initial program 92.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6474.7
Applied rewrites74.7%
if 4e5 < (*.f64 z t) Initial program 87.2%
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-/.f6479.4
Applied rewrites79.4%
Applied rewrites78.1%
Final simplification75.2%
(FPCore (x y z t a) :precision binary64 (if (<= (* t z) -2e+19) (* (/ -1.0 a) (* t z)) (if (<= (* t z) 400000.0) (/ (* y x) a) (* (/ (- t) a) z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t * z) <= -2e+19) {
tmp = (-1.0 / a) * (t * z);
} else if ((t * z) <= 400000.0) {
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) <= (-2d+19)) then
tmp = ((-1.0d0) / a) * (t * z)
else if ((t * z) <= 400000.0d0) 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) <= -2e+19) {
tmp = (-1.0 / a) * (t * z);
} else if ((t * z) <= 400000.0) {
tmp = (y * x) / a;
} else {
tmp = (-t / a) * z;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t * z) <= -2e+19: tmp = (-1.0 / a) * (t * z) elif (t * z) <= 400000.0: 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) <= -2e+19) tmp = Float64(Float64(-1.0 / a) * Float64(t * z)); elseif (Float64(t * z) <= 400000.0) 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) <= -2e+19) tmp = (-1.0 / a) * (t * z); elseif ((t * z) <= 400000.0) 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], -2e+19], N[(N[(-1.0 / a), $MachinePrecision] * N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 400000.0], 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 -2 \cdot 10^{+19}:\\
\;\;\;\;\frac{-1}{a} \cdot \left(t \cdot z\right)\\
\mathbf{elif}\;t \cdot z \leq 400000:\\
\;\;\;\;\frac{y \cdot x}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t}{a} \cdot z\\
\end{array}
\end{array}
if (*.f64 z t) < -2e19Initial program 95.0%
lift-/.f64N/A
frac-2negN/A
div-invN/A
lower-*.f64N/A
lift--.f64N/A
sub-negN/A
distribute-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
remove-double-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6495.0
Applied rewrites95.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6473.0
Applied rewrites73.0%
if -2e19 < (*.f64 z t) < 4e5Initial program 92.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6474.7
Applied rewrites74.7%
if 4e5 < (*.f64 z t) Initial program 87.2%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6420.4
Applied rewrites20.4%
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.f6478.0
Applied rewrites78.0%
Final simplification75.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ (- t) a) z))) (if (<= (* t z) -2e+19) t_1 (if (<= (* t z) 400000.0) (/ (* y x) a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (-t / a) * z;
double tmp;
if ((t * z) <= -2e+19) {
tmp = t_1;
} else if ((t * z) <= 400000.0) {
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 = (-t / a) * z
if ((t * z) <= (-2d+19)) then
tmp = t_1
else if ((t * z) <= 400000.0d0) 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 = (-t / a) * z;
double tmp;
if ((t * z) <= -2e+19) {
tmp = t_1;
} else if ((t * z) <= 400000.0) {
tmp = (y * x) / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (-t / a) * z tmp = 0 if (t * z) <= -2e+19: tmp = t_1 elif (t * z) <= 400000.0: tmp = (y * x) / a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(-t) / a) * z) tmp = 0.0 if (Float64(t * z) <= -2e+19) tmp = t_1; elseif (Float64(t * z) <= 400000.0) 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 = (-t / a) * z; tmp = 0.0; if ((t * z) <= -2e+19) tmp = t_1; elseif ((t * z) <= 400000.0) 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[((-t) / a), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[N[(t * z), $MachinePrecision], -2e+19], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], 400000.0], N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-t}{a} \cdot z\\
\mathbf{if}\;t \cdot z \leq -2 \cdot 10^{+19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \cdot z \leq 400000:\\
\;\;\;\;\frac{y \cdot x}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -2e19 or 4e5 < (*.f64 z t) Initial program 90.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6425.8
Applied rewrites25.8%
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.f6474.9
Applied rewrites74.9%
if -2e19 < (*.f64 z t) < 4e5Initial program 92.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6474.7
Applied rewrites74.7%
Final simplification74.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ (- z) a) t))) (if (<= (* t z) -2e+19) t_1 (if (<= (* t z) 400000.0) (/ (* 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) <= -2e+19) {
tmp = t_1;
} else if ((t * z) <= 400000.0) {
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) <= (-2d+19)) then
tmp = t_1
else if ((t * z) <= 400000.0d0) 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) <= -2e+19) {
tmp = t_1;
} else if ((t * z) <= 400000.0) {
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) <= -2e+19: tmp = t_1 elif (t * z) <= 400000.0: 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) <= -2e+19) tmp = t_1; elseif (Float64(t * z) <= 400000.0) 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) <= -2e+19) tmp = t_1; elseif ((t * z) <= 400000.0) 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], -2e+19], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], 400000.0], 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 -2 \cdot 10^{+19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \cdot z \leq 400000:\\
\;\;\;\;\frac{y \cdot x}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -2e19 or 4e5 < (*.f64 z t) Initial program 90.9%
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-/.f6477.2
Applied rewrites77.2%
if -2e19 < (*.f64 z t) < 4e5Initial program 92.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6474.7
Applied rewrites74.7%
Final simplification75.9%
(FPCore (x y z t a) :precision binary64 (if (<= (* t z) 5e+302) (/ (- (* 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) <= 5e+302) {
tmp = ((y * x) - (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+302) then
tmp = ((y * x) - (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+302) {
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) <= 5e+302: 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) <= 5e+302) 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) <= 5e+302) 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], 5e+302], 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 5 \cdot 10^{+302}:\\
\;\;\;\;\frac{y \cdot x - t \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t}{a} \cdot z\\
\end{array}
\end{array}
if (*.f64 z t) < 5e302Initial program 94.5%
if 5e302 < (*.f64 z t) Initial program 52.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f641.8
Applied rewrites1.8%
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.f6499.9
Applied rewrites99.9%
Final simplification94.8%
(FPCore (x y z t a) :precision binary64 (* (/ y a) x))
double code(double x, double y, double z, double t, double a) {
return (y / a) * x;
}
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 = (y / a) * x
end function
public static double code(double x, double y, double z, double t, double a) {
return (y / a) * x;
}
def code(x, y, z, t, a): return (y / a) * x
function code(x, y, z, t, a) return Float64(Float64(y / a) * x) end
function tmp = code(x, y, z, t, a) tmp = (y / a) * x; end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{a} \cdot x
\end{array}
Initial program 91.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6450.6
Applied rewrites50.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.f6449.3
Applied rewrites49.3%
Taylor expanded in t around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6448.2
Applied rewrites48.2%
(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 2024255
(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))