
(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 8 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 and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) 4e+304) (/ (- (* x y) (* z t)) a) (* x (/ y a))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= 4e+304) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = x * (y / a);
}
return tmp;
}
NOTE: x and y 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) <= 4d+304) then
tmp = ((x * y) - (z * t)) / a
else
tmp = x * (y / a)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= 4e+304) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = x * (y / a);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= 4e+304: tmp = ((x * y) - (z * t)) / a else: tmp = x * (y / a) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= 4e+304) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(x * Float64(y / a)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= 4e+304)
tmp = ((x * y) - (z * t)) / a;
else
tmp = x * (y / a);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], 4e+304], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq 4 \cdot 10^{+304}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < 3.9999999999999998e304Initial program 96.9%
if 3.9999999999999998e304 < (*.f64 x y) Initial program 57.9%
Taylor expanded in x around inf 63.2%
associate-/l*99.8%
associate-/r/99.8%
Applied egg-rr99.8%
Final simplification97.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (- (* x y) (* z t)) INFINITY) (/ (fma (- z) t (* x y)) a) (- (* y (/ x a)) (* t (/ z a)))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((x * y) - (z * t)) <= ((double) INFINITY)) {
tmp = fma(-z, t, (x * y)) / a;
} else {
tmp = (y * (x / a)) - (t * (z / a));
}
return tmp;
}
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(x * y) - Float64(z * t)) <= Inf) tmp = Float64(fma(Float64(-z), t, Float64(x * y)) / a); else tmp = Float64(Float64(y * Float64(x / a)) - Float64(t * Float64(z / a))); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[((-z) * t + N[(x * y), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot t \leq \infty:\\
\;\;\;\;\frac{\mathsf{fma}\left(-z, t, x \cdot y\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a} - t \cdot \frac{z}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < +inf.0Initial program 94.6%
sub-neg94.6%
+-commutative94.6%
distribute-lft-neg-in94.6%
fma-def94.6%
Applied egg-rr94.6%
if +inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 0.0%
sub-neg0.0%
+-commutative0.0%
distribute-lft-neg-in0.0%
fma-def53.5%
Applied egg-rr53.5%
Taylor expanded in z around 0 0.0%
associate-*l/0.1%
+-commutative0.1%
mul-1-neg0.1%
associate-*r/50.0%
distribute-lft-neg-in50.0%
cancel-sign-sub-inv50.0%
associate-*l/3.5%
associate-*r/50.0%
Simplified50.0%
Final simplification94.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (let* ((t_1 (- (* x y) (* z t)))) (if (<= t_1 INFINITY) (/ t_1 a) (- (* y (/ x a)) (* t (/ z a))))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1 / a;
} else {
tmp = (y * (x / a)) - (t * (z / a));
}
return tmp;
}
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1 / a;
} else {
tmp = (y * (x / a)) - (t * (z / a));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): t_1 = (x * y) - (z * t) tmp = 0 if t_1 <= math.inf: tmp = t_1 / a else: tmp = (y * (x / a)) - (t * (z / a)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= Inf) tmp = Float64(t_1 / a); else tmp = Float64(Float64(y * Float64(x / a)) - Float64(t * Float64(z / a))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if (t_1 <= Inf)
tmp = t_1 / a;
else
tmp = (y * (x / a)) - (t * (z / a));
end
tmp_2 = tmp;
end
NOTE: x and y 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[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], N[(t$95$1 / a), $MachinePrecision], N[(N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq \infty:\\
\;\;\;\;\frac{t_1}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a} - t \cdot \frac{z}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < +inf.0Initial program 94.6%
if +inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 0.0%
sub-neg0.0%
+-commutative0.0%
distribute-lft-neg-in0.0%
fma-def53.5%
Applied egg-rr53.5%
Taylor expanded in z around 0 0.0%
associate-*l/0.1%
+-commutative0.1%
mul-1-neg0.1%
associate-*r/50.0%
distribute-lft-neg-in50.0%
cancel-sign-sub-inv50.0%
associate-*l/3.5%
associate-*r/50.0%
Simplified50.0%
Final simplification94.3%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* z (- t)) a)) (t_2 (* x (/ y a))))
(if (<= y -4.7e-90)
t_2
(if (<= y -1.75e-168)
t_1
(if (<= y -4e-200)
t_2
(if (<= y 4.9e+20)
t_1
(if (<= y 1.15e+88)
(/ (* x y) a)
(if (<= y 2.25e+130) t_1 (* y (/ x a))))))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double t_1 = (z * -t) / a;
double t_2 = x * (y / a);
double tmp;
if (y <= -4.7e-90) {
tmp = t_2;
} else if (y <= -1.75e-168) {
tmp = t_1;
} else if (y <= -4e-200) {
tmp = t_2;
} else if (y <= 4.9e+20) {
tmp = t_1;
} else if (y <= 1.15e+88) {
tmp = (x * y) / a;
} else if (y <= 2.25e+130) {
tmp = t_1;
} else {
tmp = y * (x / a);
}
return tmp;
}
NOTE: x and y 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) :: t_2
real(8) :: tmp
t_1 = (z * -t) / a
t_2 = x * (y / a)
if (y <= (-4.7d-90)) then
tmp = t_2
else if (y <= (-1.75d-168)) then
tmp = t_1
else if (y <= (-4d-200)) then
tmp = t_2
else if (y <= 4.9d+20) then
tmp = t_1
else if (y <= 1.15d+88) then
tmp = (x * y) / a
else if (y <= 2.25d+130) then
tmp = t_1
else
tmp = y * (x / a)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z * -t) / a;
double t_2 = x * (y / a);
double tmp;
if (y <= -4.7e-90) {
tmp = t_2;
} else if (y <= -1.75e-168) {
tmp = t_1;
} else if (y <= -4e-200) {
tmp = t_2;
} else if (y <= 4.9e+20) {
tmp = t_1;
} else if (y <= 1.15e+88) {
tmp = (x * y) / a;
} else if (y <= 2.25e+130) {
tmp = t_1;
} else {
tmp = y * (x / a);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): t_1 = (z * -t) / a t_2 = x * (y / a) tmp = 0 if y <= -4.7e-90: tmp = t_2 elif y <= -1.75e-168: tmp = t_1 elif y <= -4e-200: tmp = t_2 elif y <= 4.9e+20: tmp = t_1 elif y <= 1.15e+88: tmp = (x * y) / a elif y <= 2.25e+130: tmp = t_1 else: tmp = y * (x / a) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) t_1 = Float64(Float64(z * Float64(-t)) / a) t_2 = Float64(x * Float64(y / a)) tmp = 0.0 if (y <= -4.7e-90) tmp = t_2; elseif (y <= -1.75e-168) tmp = t_1; elseif (y <= -4e-200) tmp = t_2; elseif (y <= 4.9e+20) tmp = t_1; elseif (y <= 1.15e+88) tmp = Float64(Float64(x * y) / a); elseif (y <= 2.25e+130) tmp = t_1; else tmp = Float64(y * Float64(x / a)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (z * -t) / a;
t_2 = x * (y / a);
tmp = 0.0;
if (y <= -4.7e-90)
tmp = t_2;
elseif (y <= -1.75e-168)
tmp = t_1;
elseif (y <= -4e-200)
tmp = t_2;
elseif (y <= 4.9e+20)
tmp = t_1;
elseif (y <= 1.15e+88)
tmp = (x * y) / a;
elseif (y <= 2.25e+130)
tmp = t_1;
else
tmp = y * (x / a);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z * (-t)), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.7e-90], t$95$2, If[LessEqual[y, -1.75e-168], t$95$1, If[LessEqual[y, -4e-200], t$95$2, If[LessEqual[y, 4.9e+20], t$95$1, If[LessEqual[y, 1.15e+88], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, 2.25e+130], t$95$1, N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := \frac{z \cdot \left(-t\right)}{a}\\
t_2 := x \cdot \frac{y}{a}\\
\mathbf{if}\;y \leq -4.7 \cdot 10^{-90}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -1.75 \cdot 10^{-168}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-200}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 4.9 \cdot 10^{+20}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{+88}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;y \leq 2.25 \cdot 10^{+130}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if y < -4.7e-90 or -1.74999999999999991e-168 < y < -3.9999999999999999e-200Initial program 93.4%
Taylor expanded in x around inf 62.5%
associate-/l*67.5%
associate-/r/63.7%
Applied egg-rr63.7%
if -4.7e-90 < y < -1.74999999999999991e-168 or -3.9999999999999999e-200 < y < 4.9e20 or 1.1500000000000001e88 < y < 2.2500000000000002e130Initial program 97.4%
Taylor expanded in x around 0 75.6%
associate-*r/75.6%
associate-*r*75.6%
neg-mul-175.6%
Simplified75.6%
if 4.9e20 < y < 1.1500000000000001e88Initial program 99.7%
Taylor expanded in x around inf 75.1%
if 2.2500000000000002e130 < y Initial program 84.1%
Taylor expanded in x around inf 63.9%
associate-*r/71.4%
Simplified71.4%
Final simplification71.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (or (<= z -7.5e-24) (not (<= z 5.4e-129))) (/ (- t) (/ a z)) (/ (* x y) a)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.5e-24) || !(z <= 5.4e-129)) {
tmp = -t / (a / z);
} else {
tmp = (x * y) / a;
}
return tmp;
}
NOTE: x and y 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 ((z <= (-7.5d-24)) .or. (.not. (z <= 5.4d-129))) then
tmp = -t / (a / z)
else
tmp = (x * y) / a
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.5e-24) || !(z <= 5.4e-129)) {
tmp = -t / (a / z);
} else {
tmp = (x * y) / a;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if (z <= -7.5e-24) or not (z <= 5.4e-129): tmp = -t / (a / z) else: tmp = (x * y) / a return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.5e-24) || !(z <= 5.4e-129)) tmp = Float64(Float64(-t) / Float64(a / z)); else tmp = Float64(Float64(x * y) / a); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((z <= -7.5e-24) || ~((z <= 5.4e-129)))
tmp = -t / (a / z);
else
tmp = (x * y) / a;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.5e-24], N[Not[LessEqual[z, 5.4e-129]], $MachinePrecision]], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{-24} \lor \neg \left(z \leq 5.4 \cdot 10^{-129}\right):\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if z < -7.50000000000000007e-24 or 5.39999999999999998e-129 < z Initial program 92.0%
Taylor expanded in x around 0 65.7%
associate-*r/65.7%
associate-*r*65.7%
neg-mul-165.7%
Simplified65.7%
associate-/l*63.9%
distribute-frac-neg63.9%
Applied egg-rr63.9%
if -7.50000000000000007e-24 < z < 5.39999999999999998e-129Initial program 96.8%
Taylor expanded in x around inf 70.2%
Final simplification66.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= z -1.55e-24) (/ (- t) (/ a z)) (if (<= z 5.4e-129) (/ (* x y) a) (* z (/ (- t) a)))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.55e-24) {
tmp = -t / (a / z);
} else if (z <= 5.4e-129) {
tmp = (x * y) / a;
} else {
tmp = z * (-t / a);
}
return tmp;
}
NOTE: x and y 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 (z <= (-1.55d-24)) then
tmp = -t / (a / z)
else if (z <= 5.4d-129) then
tmp = (x * y) / a
else
tmp = z * (-t / a)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.55e-24) {
tmp = -t / (a / z);
} else if (z <= 5.4e-129) {
tmp = (x * y) / a;
} else {
tmp = z * (-t / a);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if z <= -1.55e-24: tmp = -t / (a / z) elif z <= 5.4e-129: tmp = (x * y) / a else: tmp = z * (-t / a) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.55e-24) tmp = Float64(Float64(-t) / Float64(a / z)); elseif (z <= 5.4e-129) tmp = Float64(Float64(x * y) / a); else tmp = Float64(z * Float64(Float64(-t) / a)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (z <= -1.55e-24)
tmp = -t / (a / z);
elseif (z <= 5.4e-129)
tmp = (x * y) / a;
else
tmp = z * (-t / a);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.55e-24], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.4e-129], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{-24}:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{-129}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\end{array}
\end{array}
if z < -1.55e-24Initial program 93.0%
Taylor expanded in x around 0 72.7%
associate-*r/72.7%
associate-*r*72.7%
neg-mul-172.7%
Simplified72.7%
associate-/l*71.3%
distribute-frac-neg71.3%
Applied egg-rr71.3%
if -1.55e-24 < z < 5.39999999999999998e-129Initial program 96.8%
Taylor expanded in x around inf 70.2%
if 5.39999999999999998e-129 < z Initial program 91.3%
sub-neg91.3%
+-commutative91.3%
distribute-lft-neg-in91.3%
fma-def91.4%
Applied egg-rr91.4%
Taylor expanded in z around inf 60.2%
mul-1-neg60.2%
associate-*l/59.1%
*-commutative59.1%
distribute-rgt-neg-in59.1%
Simplified59.1%
Final simplification66.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* y (/ x a)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
NOTE: x and y 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;
public static double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): return y * (x / a)
x, y = sort([x, y]) function code(x, y, z, t, a) return Float64(y * Float64(x / a)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a)
tmp = y * (x / a);
end
NOTE: x and y 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] = \mathsf{sort}([x, y])\\
\\
y \cdot \frac{x}{a}
\end{array}
Initial program 93.9%
Taylor expanded in x around inf 47.1%
associate-*r/48.5%
Simplified48.5%
Final simplification48.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (/ y (/ a x)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
return y / (a / x);
}
NOTE: x and y 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 / (a / x)
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
return y / (a / x);
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): return y / (a / x)
x, y = sort([x, y]) function code(x, y, z, t, a) return Float64(y / Float64(a / x)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a)
tmp = y / (a / x);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y}{\frac{a}{x}}
\end{array}
Initial program 93.9%
Taylor expanded in x around inf 47.1%
associate-/l*48.9%
Simplified48.9%
Final simplification48.9%
(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 2023224
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:herbie-target
(if (< z -2.468684968699548e+170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))
(/ (- (* x y) (* z t)) a))