
(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}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* t z))))
(if (or (<= t_1 -2e+293) (not (<= t_1 1e+307)))
(* y (- (/ x a) (* (/ t a) (/ z y))))
(/ t_1 a))))assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (t * z);
double tmp;
if ((t_1 <= -2e+293) || !(t_1 <= 1e+307)) {
tmp = y * ((x / a) - ((t / a) * (z / y)));
} else {
tmp = t_1 / a;
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 = (x * y) - (t * z)
if ((t_1 <= (-2d+293)) .or. (.not. (t_1 <= 1d+307))) then
tmp = y * ((x / a) - ((t / a) * (z / y)))
else
tmp = t_1 / a
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (t * z);
double tmp;
if ((t_1 <= -2e+293) || !(t_1 <= 1e+307)) {
tmp = y * ((x / a) - ((t / a) * (z / y)));
} else {
tmp = t_1 / a;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (x * y) - (t * z) tmp = 0 if (t_1 <= -2e+293) or not (t_1 <= 1e+307): tmp = y * ((x / a) - ((t / a) * (z / y))) else: tmp = t_1 / a return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(t * z)) tmp = 0.0 if ((t_1 <= -2e+293) || !(t_1 <= 1e+307)) tmp = Float64(y * Float64(Float64(x / a) - Float64(Float64(t / a) * Float64(z / y)))); else tmp = Float64(t_1 / a); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - (t * z);
tmp = 0.0;
if ((t_1 <= -2e+293) || ~((t_1 <= 1e+307)))
tmp = y * ((x / a) - ((t / a) * (z / y)));
else
tmp = t_1 / a;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+293], N[Not[LessEqual[t$95$1, 1e+307]], $MachinePrecision]], N[(y * N[(N[(x / a), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - t \cdot z\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+293} \lor \neg \left(t\_1 \leq 10^{+307}\right):\\
\;\;\;\;y \cdot \left(\frac{x}{a} - \frac{t}{a} \cdot \frac{z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -1.9999999999999998e293 or 9.99999999999999986e306 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 67.3%
Taylor expanded in y around inf 77.9%
+-commutative77.9%
mul-1-neg77.9%
unsub-neg77.9%
times-frac84.6%
Simplified84.6%
if -1.9999999999999998e293 < (-.f64 (*.f64 x y) (*.f64 z t)) < 9.99999999999999986e306Initial program 98.7%
Final simplification95.5%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= a 7.6e+88) (/ (* x (- y (/ (* t z) x))) a) (- (* (/ x (sqrt a)) (/ y (sqrt a))) (* t (/ z a)))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 7.6e+88) {
tmp = (x * (y - ((t * z) / x))) / a;
} else {
tmp = ((x / sqrt(a)) * (y / sqrt(a))) - (t * (z / a));
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 (a <= 7.6d+88) then
tmp = (x * (y - ((t * z) / x))) / a
else
tmp = ((x / sqrt(a)) * (y / sqrt(a))) - (t * (z / a))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 7.6e+88) {
tmp = (x * (y - ((t * z) / x))) / a;
} else {
tmp = ((x / Math.sqrt(a)) * (y / Math.sqrt(a))) - (t * (z / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if a <= 7.6e+88: tmp = (x * (y - ((t * z) / x))) / a else: tmp = ((x / math.sqrt(a)) * (y / math.sqrt(a))) - (t * (z / a)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (a <= 7.6e+88) tmp = Float64(Float64(x * Float64(y - Float64(Float64(t * z) / x))) / a); else tmp = Float64(Float64(Float64(x / sqrt(a)) * Float64(y / sqrt(a))) - Float64(t * Float64(z / a))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (a <= 7.6e+88)
tmp = (x * (y - ((t * z) / x))) / a;
else
tmp = ((x / sqrt(a)) * (y / sqrt(a))) - (t * (z / a));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[a, 7.6e+88], N[(N[(x * N[(y - N[(N[(t * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(N[(x / N[Sqrt[a], $MachinePrecision]), $MachinePrecision] * N[(y / N[Sqrt[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq 7.6 \cdot 10^{+88}:\\
\;\;\;\;\frac{x \cdot \left(y - \frac{t \cdot z}{x}\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\sqrt{a}} \cdot \frac{y}{\sqrt{a}} - t \cdot \frac{z}{a}\\
\end{array}
\end{array}
if a < 7.5999999999999993e88Initial program 93.8%
Taylor expanded in x around inf 91.5%
associate-*r/91.5%
mul-1-neg91.5%
Simplified91.5%
if 7.5999999999999993e88 < a Initial program 81.3%
div-sub81.3%
*-un-lft-identity81.3%
add-sqr-sqrt81.1%
times-frac81.1%
fmm-def81.1%
associate-/l*84.5%
Applied egg-rr84.5%
fmm-undef84.5%
associate-*r/81.1%
*-commutative81.1%
associate-/l*87.4%
associate-*l/87.4%
*-lft-identity87.4%
associate-/l*87.5%
associate-*l/92.8%
Simplified92.8%
Final simplification91.8%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (let* ((t_1 (- (* x y) (* t z)))) (if (<= t_1 (- INFINITY)) (* t (- (* x (/ y (* a t))) (/ z a))) (/ t_1 a))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (t * z);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t * ((x * (y / (a * t))) - (z / a));
} else {
tmp = t_1 / a;
}
return tmp;
}
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (t * z);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = t * ((x * (y / (a * t))) - (z / a));
} else {
tmp = t_1 / a;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (x * y) - (t * z) tmp = 0 if t_1 <= -math.inf: tmp = t * ((x * (y / (a * t))) - (z / a)) else: tmp = t_1 / a return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(t * z)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(t * Float64(Float64(x * Float64(y / Float64(a * t))) - Float64(z / a))); else tmp = Float64(t_1 / a); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - (t * z);
tmp = 0.0;
if (t_1 <= -Inf)
tmp = t * ((x * (y / (a * t))) - (z / a));
else
tmp = t_1 / a;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(t * N[(N[(x * N[(y / N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - t \cdot z\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t \cdot \left(x \cdot \frac{y}{a \cdot t} - \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 66.2%
Taylor expanded in t around inf 79.4%
+-commutative79.4%
mul-1-neg79.4%
unsub-neg79.4%
associate-/l*92.8%
*-commutative92.8%
Simplified92.8%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 94.7%
Final simplification94.5%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -5e-5) (/ x (/ a y)) (if (<= (* x y) 5e+52) (/ (* t z) (- a)) (/ y (/ a x)))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e-5) {
tmp = x / (a / y);
} else if ((x * y) <= 5e+52) {
tmp = (t * z) / -a;
} else {
tmp = y / (a / x);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 ((x * y) <= (-5d-5)) then
tmp = x / (a / y)
else if ((x * y) <= 5d+52) then
tmp = (t * z) / -a
else
tmp = y / (a / x)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e-5) {
tmp = x / (a / y);
} else if ((x * y) <= 5e+52) {
tmp = (t * z) / -a;
} else {
tmp = y / (a / x);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -5e-5: tmp = x / (a / y) elif (x * y) <= 5e+52: tmp = (t * z) / -a else: tmp = y / (a / x) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -5e-5) tmp = Float64(x / Float64(a / y)); elseif (Float64(x * y) <= 5e+52) tmp = Float64(Float64(t * z) / Float64(-a)); else tmp = Float64(y / Float64(a / x)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -5e-5)
tmp = x / (a / y);
elseif ((x * y) <= 5e+52)
tmp = (t * z) / -a;
else
tmp = y / (a / x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e-5], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+52], N[(N[(t * z), $MachinePrecision] / (-a)), $MachinePrecision], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{-5}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+52}:\\
\;\;\;\;\frac{t \cdot z}{-a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\end{array}
\end{array}
if (*.f64 x y) < -5.00000000000000024e-5Initial program 90.0%
Taylor expanded in x around inf 74.0%
associate-*r/71.0%
Simplified71.0%
clear-num70.2%
un-div-inv71.3%
Applied egg-rr71.3%
if -5.00000000000000024e-5 < (*.f64 x y) < 5e52Initial program 95.7%
Taylor expanded in x around 0 72.0%
mul-1-neg72.0%
*-commutative72.0%
distribute-rgt-neg-in72.0%
Simplified72.0%
if 5e52 < (*.f64 x y) Initial program 85.3%
add-cube-cbrt84.6%
pow384.6%
Applied egg-rr84.6%
Taylor expanded in x around inf 87.0%
associate-*r/87.0%
mul-1-neg87.0%
distribute-rgt-neg-in87.0%
Simplified87.0%
Taylor expanded in x around inf 78.5%
*-commutative78.5%
associate-*r/83.2%
Simplified83.2%
clear-num83.1%
un-div-inv83.2%
Applied egg-rr83.2%
Final simplification74.4%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -5e-5) (/ x (/ a y)) (if (<= (* x y) 5e+52) (* z (/ (- t) a)) (/ y (/ a x)))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e-5) {
tmp = x / (a / y);
} else if ((x * y) <= 5e+52) {
tmp = z * (-t / a);
} else {
tmp = y / (a / x);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 ((x * y) <= (-5d-5)) then
tmp = x / (a / y)
else if ((x * y) <= 5d+52) then
tmp = z * (-t / a)
else
tmp = y / (a / x)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e-5) {
tmp = x / (a / y);
} else if ((x * y) <= 5e+52) {
tmp = z * (-t / a);
} else {
tmp = y / (a / x);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -5e-5: tmp = x / (a / y) elif (x * y) <= 5e+52: tmp = z * (-t / a) else: tmp = y / (a / x) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -5e-5) tmp = Float64(x / Float64(a / y)); elseif (Float64(x * y) <= 5e+52) tmp = Float64(z * Float64(Float64(-t) / a)); else tmp = Float64(y / Float64(a / x)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -5e-5)
tmp = x / (a / y);
elseif ((x * y) <= 5e+52)
tmp = z * (-t / a);
else
tmp = y / (a / x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e-5], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+52], N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{-5}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+52}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\end{array}
\end{array}
if (*.f64 x y) < -5.00000000000000024e-5Initial program 90.0%
Taylor expanded in x around inf 74.0%
associate-*r/71.0%
Simplified71.0%
clear-num70.2%
un-div-inv71.3%
Applied egg-rr71.3%
if -5.00000000000000024e-5 < (*.f64 x y) < 5e52Initial program 95.7%
Taylor expanded in x around 0 72.0%
mul-1-neg72.0%
*-commutative72.0%
associate-*r/70.3%
distribute-rgt-neg-in70.3%
distribute-frac-neg70.3%
Simplified70.3%
if 5e52 < (*.f64 x y) Initial program 85.3%
add-cube-cbrt84.6%
pow384.6%
Applied egg-rr84.6%
Taylor expanded in x around inf 87.0%
associate-*r/87.0%
mul-1-neg87.0%
distribute-rgt-neg-in87.0%
Simplified87.0%
Taylor expanded in x around inf 78.5%
*-commutative78.5%
associate-*r/83.2%
Simplified83.2%
clear-num83.1%
un-div-inv83.2%
Applied egg-rr83.2%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -5e-5) (/ x (/ a y)) (if (<= (* x y) 2e-90) (/ (- t) (/ a z)) (/ y (/ a x)))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e-5) {
tmp = x / (a / y);
} else if ((x * y) <= 2e-90) {
tmp = -t / (a / z);
} else {
tmp = y / (a / x);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 ((x * y) <= (-5d-5)) then
tmp = x / (a / y)
else if ((x * y) <= 2d-90) then
tmp = -t / (a / z)
else
tmp = y / (a / x)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e-5) {
tmp = x / (a / y);
} else if ((x * y) <= 2e-90) {
tmp = -t / (a / z);
} else {
tmp = y / (a / x);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -5e-5: tmp = x / (a / y) elif (x * y) <= 2e-90: tmp = -t / (a / z) else: tmp = y / (a / x) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -5e-5) tmp = Float64(x / Float64(a / y)); elseif (Float64(x * y) <= 2e-90) tmp = Float64(Float64(-t) / Float64(a / z)); else tmp = Float64(y / Float64(a / x)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -5e-5)
tmp = x / (a / y);
elseif ((x * y) <= 2e-90)
tmp = -t / (a / z);
else
tmp = y / (a / x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e-5], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-90], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{-5}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-90}:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\end{array}
\end{array}
if (*.f64 x y) < -5.00000000000000024e-5Initial program 90.0%
Taylor expanded in x around inf 74.0%
associate-*r/71.0%
Simplified71.0%
clear-num70.2%
un-div-inv71.3%
Applied egg-rr71.3%
if -5.00000000000000024e-5 < (*.f64 x y) < 1.99999999999999999e-90Initial program 94.9%
Taylor expanded in x around 0 76.0%
mul-1-neg76.0%
*-commutative76.0%
associate-*r/75.3%
distribute-rgt-neg-in75.3%
distribute-frac-neg75.3%
Simplified75.3%
clear-num75.2%
un-div-inv75.2%
add-sqr-sqrt37.4%
sqrt-unprod36.2%
sqr-neg36.2%
sqrt-unprod5.4%
add-sqr-sqrt9.4%
Applied egg-rr9.4%
associate-/r/9.4%
Simplified9.4%
add-sqr-sqrt8.2%
sqrt-unprod38.3%
*-commutative38.3%
*-commutative38.3%
swap-sqr34.0%
sqr-neg34.0%
distribute-frac-neg34.0%
distribute-frac-neg34.0%
swap-sqr38.3%
sqrt-unprod39.6%
add-sqr-sqrt71.2%
distribute-frac-neg71.2%
distribute-rgt-neg-out71.2%
clear-num71.2%
un-div-inv72.1%
Applied egg-rr72.1%
if 1.99999999999999999e-90 < (*.f64 x y) Initial program 89.0%
add-cube-cbrt88.2%
pow388.3%
Applied egg-rr88.3%
Taylor expanded in x around inf 88.9%
associate-*r/88.9%
mul-1-neg88.9%
distribute-rgt-neg-in88.9%
Simplified88.9%
Taylor expanded in x around inf 71.7%
*-commutative71.7%
associate-*r/75.1%
Simplified75.1%
clear-num75.0%
un-div-inv75.1%
Applied egg-rr75.1%
Final simplification72.8%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* t z) 4e+299) (/ (- (* x y) (* t z)) a) (* z (/ (- t) a))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t * z) <= 4e+299) {
tmp = ((x * y) - (t * z)) / a;
} else {
tmp = z * (-t / a);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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) <= 4d+299) then
tmp = ((x * y) - (t * z)) / a
else
tmp = z * (-t / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t * z) <= 4e+299) {
tmp = ((x * y) - (t * z)) / a;
} else {
tmp = z * (-t / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (t * z) <= 4e+299: tmp = ((x * y) - (t * z)) / a else: tmp = z * (-t / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(t * z) <= 4e+299) tmp = Float64(Float64(Float64(x * y) - Float64(t * z)) / a); else tmp = Float64(z * Float64(Float64(-t) / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((t * z) <= 4e+299)
tmp = ((x * y) - (t * z)) / a;
else
tmp = z * (-t / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(t * z), $MachinePrecision], 4e+299], N[(N[(N[(x * y), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq 4 \cdot 10^{+299}:\\
\;\;\;\;\frac{x \cdot y - t \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < 4.0000000000000002e299Initial program 93.8%
if 4.0000000000000002e299 < (*.f64 z t) Initial program 62.4%
Taylor expanded in x around 0 67.9%
mul-1-neg67.9%
*-commutative67.9%
associate-*r/94.4%
distribute-rgt-neg-in94.4%
distribute-frac-neg94.4%
Simplified94.4%
Final simplification93.8%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* y (/ x a)))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 * (x / a)
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return y * (x / a)
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(y * Float64(x / a)) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = y * (x / a);
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
y \cdot \frac{x}{a}
\end{array}
Initial program 91.6%
add-cube-cbrt91.1%
pow391.0%
Applied egg-rr91.0%
Taylor expanded in x around inf 88.6%
associate-*r/88.6%
mul-1-neg88.6%
distribute-rgt-neg-in88.6%
Simplified88.6%
Taylor expanded in x around inf 55.2%
*-commutative55.2%
associate-*r/56.3%
Simplified56.3%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* x (/ y a)))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 / a)
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return x * (y / a)
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(x * Float64(y / a)) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = x * (y / a);
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
x \cdot \frac{y}{a}
\end{array}
Initial program 91.6%
Taylor expanded in x around inf 55.2%
associate-*r/54.3%
Simplified54.3%
(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 2024170
(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))