
(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 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))
(- (* y (/ x a)) (* t (/ z a)))
(if (<= t_1 4e+285) (/ t_1 a) (- (/ x (/ a y)) (/ z (/ a t)))))))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 = (y * (x / a)) - (t * (z / a));
} else if (t_1 <= 4e+285) {
tmp = t_1 / a;
} else {
tmp = (x / (a / y)) - (z / (a / t));
}
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 = (y * (x / a)) - (t * (z / a));
} else if (t_1 <= 4e+285) {
tmp = t_1 / a;
} else {
tmp = (x / (a / y)) - (z / (a / t));
}
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 = (y * (x / a)) - (t * (z / a)) elif t_1 <= 4e+285: tmp = t_1 / a else: tmp = (x / (a / y)) - (z / (a / t)) 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 <= Float64(-Inf)) tmp = Float64(Float64(y * Float64(x / a)) - Float64(t * Float64(z / a))); elseif (t_1 <= 4e+285) tmp = Float64(t_1 / a); else tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t))); 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 = (y * (x / a)) - (t * (z / a));
elseif (t_1 <= 4e+285)
tmp = t_1 / a;
else
tmp = (x / (a / y)) - (z / (a / t));
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[(N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+285], N[(t$95$1 / a), $MachinePrecision], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $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:\\
\;\;\;\;y \cdot \frac{x}{a} - t \cdot \frac{z}{a}\\
\mathbf{elif}\;t_1 \leq 4 \cdot 10^{+285}:\\
\;\;\;\;\frac{t_1}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 66.6%
Taylor expanded in x around 0 63.0%
+-commutative63.0%
mul-1-neg63.0%
unsub-neg63.0%
associate-*l/72.6%
*-commutative72.6%
div-inv72.6%
associate-*l*92.6%
div-inv92.6%
Applied egg-rr92.6%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 3.9999999999999999e285Initial program 99.7%
if 3.9999999999999999e285 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 65.2%
div-sub55.2%
associate-/l*64.3%
associate-/l*79.9%
Applied egg-rr79.9%
Final simplification96.6%
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 (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+276)))
(- (* y (/ x a)) (* t (/ z a)))
(/ t_1 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)) || !(t_1 <= 2e+276)) {
tmp = (y * (x / a)) - (t * (z / a));
} else {
tmp = t_1 / 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) || !(t_1 <= 2e+276)) {
tmp = (y * (x / a)) - (t * (z / a));
} else {
tmp = t_1 / 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) or not (t_1 <= 2e+276): tmp = (y * (x / a)) - (t * (z / a)) else: tmp = t_1 / 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 <= Float64(-Inf)) || !(t_1 <= 2e+276)) tmp = Float64(Float64(y * Float64(x / a)) - Float64(t * Float64(z / a))); else tmp = Float64(t_1 / 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) || ~((t_1 <= 2e+276)))
tmp = (y * (x / a)) - (t * (z / a));
else
tmp = t_1 / 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[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+276]], $MachinePrecision]], N[(N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $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 \lor \neg \left(t_1 \leq 2 \cdot 10^{+276}\right):\\
\;\;\;\;y \cdot \frac{x}{a} - t \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0 or 2.0000000000000001e276 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 67.0%
Taylor expanded in x around 0 60.3%
+-commutative60.3%
mul-1-neg60.3%
unsub-neg60.3%
associate-*l/71.0%
*-commutative71.0%
div-inv71.0%
associate-*l*88.2%
div-inv88.1%
Applied egg-rr88.1%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 2.0000000000000001e276Initial program 99.7%
Final simplification97.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* z t) -2e+194) (* z (/ (- t) a)) (if (<= (* z t) 1e+284) (/ (- (* x y) (* z t)) a) (/ (- t) (/ a z)))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= -2e+194) {
tmp = z * (-t / a);
} else if ((z * t) <= 1e+284) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = -t / (a / z);
}
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 * t) <= (-2d+194)) then
tmp = z * (-t / a)
else if ((z * t) <= 1d+284) then
tmp = ((x * y) - (z * t)) / a
else
tmp = -t / (a / z)
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 * t) <= -2e+194) {
tmp = z * (-t / a);
} else if ((z * t) <= 1e+284) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = -t / (a / z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if (z * t) <= -2e+194: tmp = z * (-t / a) elif (z * t) <= 1e+284: tmp = ((x * y) - (z * t)) / a else: tmp = -t / (a / z) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(z * t) <= -2e+194) tmp = Float64(z * Float64(Float64(-t) / a)); elseif (Float64(z * t) <= 1e+284) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(Float64(-t) / Float64(a / z)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((z * t) <= -2e+194)
tmp = z * (-t / a);
elseif ((z * t) <= 1e+284)
tmp = ((x * y) - (z * t)) / a;
else
tmp = -t / (a / z);
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[(z * t), $MachinePrecision], -2e+194], N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+284], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+194}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\mathbf{elif}\;z \cdot t \leq 10^{+284}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\end{array}
\end{array}
if (*.f64 z t) < -1.99999999999999989e194Initial program 79.5%
Taylor expanded in x around 0 72.3%
clear-num72.3%
associate-/r/72.3%
Applied egg-rr72.3%
+-commutative72.3%
associate-*r*72.3%
mul-1-neg72.3%
cancel-sign-sub-inv72.3%
div-inv72.3%
*-commutative72.3%
distribute-rgt-out--79.4%
Applied egg-rr79.4%
Taylor expanded in x around 0 79.5%
mul-1-neg79.5%
*-commutative79.5%
associate-*r/96.3%
distribute-rgt-neg-in96.3%
distribute-neg-frac96.3%
Simplified96.3%
if -1.99999999999999989e194 < (*.f64 z t) < 1.00000000000000008e284Initial program 96.3%
if 1.00000000000000008e284 < (*.f64 z t) Initial program 52.6%
Taylor expanded in x around 0 52.6%
mul-1-neg52.6%
associate-/l*92.6%
Simplified92.6%
Final simplification96.1%
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 -2.9e+63) (not (<= z 6.6e-137))) (/ (- 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 <= -2.9e+63) || !(z <= 6.6e-137)) {
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 <= (-2.9d+63)) .or. (.not. (z <= 6.6d-137))) 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 <= -2.9e+63) || !(z <= 6.6e-137)) {
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 <= -2.9e+63) or not (z <= 6.6e-137): 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 <= -2.9e+63) || !(z <= 6.6e-137)) 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 <= -2.9e+63) || ~((z <= 6.6e-137)))
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, -2.9e+63], N[Not[LessEqual[z, 6.6e-137]], $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 -2.9 \cdot 10^{+63} \lor \neg \left(z \leq 6.6 \cdot 10^{-137}\right):\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if z < -2.8999999999999999e63 or 6.6000000000000004e-137 < z Initial program 89.2%
Taylor expanded in x around 0 63.8%
mul-1-neg63.8%
associate-/l*66.4%
Simplified66.4%
if -2.8999999999999999e63 < z < 6.6000000000000004e-137Initial program 95.6%
Taylor expanded in x around inf 69.3%
Final simplification67.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= z -2.95e+63) (/ (- t) (/ a z)) (if (<= z 4.6e-144) (/ (* 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 <= -2.95e+63) {
tmp = -t / (a / z);
} else if (z <= 4.6e-144) {
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 <= (-2.95d+63)) then
tmp = -t / (a / z)
else if (z <= 4.6d-144) 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 <= -2.95e+63) {
tmp = -t / (a / z);
} else if (z <= 4.6e-144) {
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 <= -2.95e+63: tmp = -t / (a / z) elif z <= 4.6e-144: 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 <= -2.95e+63) tmp = Float64(Float64(-t) / Float64(a / z)); elseif (z <= 4.6e-144) 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 <= -2.95e+63)
tmp = -t / (a / z);
elseif (z <= 4.6e-144)
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, -2.95e+63], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.6e-144], 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 -2.95 \cdot 10^{+63}:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-144}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\end{array}
\end{array}
if z < -2.95000000000000014e63Initial program 89.6%
Taylor expanded in x around 0 65.1%
mul-1-neg65.1%
associate-/l*70.1%
Simplified70.1%
if -2.95000000000000014e63 < z < 4.6e-144Initial program 95.5%
Taylor expanded in x around inf 68.5%
if 4.6e-144 < z Initial program 89.4%
Taylor expanded in x around 0 86.0%
clear-num86.0%
associate-/r/86.0%
Applied egg-rr86.0%
+-commutative86.0%
associate-*r*86.0%
mul-1-neg86.0%
cancel-sign-sub-inv86.0%
div-inv86.0%
*-commutative86.0%
distribute-rgt-out--89.3%
Applied egg-rr89.3%
Taylor expanded in x around 0 62.0%
mul-1-neg62.0%
*-commutative62.0%
associate-*r/62.9%
distribute-rgt-neg-in62.9%
distribute-neg-frac62.9%
Simplified62.9%
Final simplification66.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= z -2.05e+63) (* t (/ (- z) a)) (if (<= z 4.6e-144) (/ (* 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 <= -2.05e+63) {
tmp = t * (-z / a);
} else if (z <= 4.6e-144) {
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 <= (-2.05d+63)) then
tmp = t * (-z / a)
else if (z <= 4.6d-144) 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 <= -2.05e+63) {
tmp = t * (-z / a);
} else if (z <= 4.6e-144) {
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 <= -2.05e+63: tmp = t * (-z / a) elif z <= 4.6e-144: 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 <= -2.05e+63) tmp = Float64(t * Float64(Float64(-z) / a)); elseif (z <= 4.6e-144) 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 <= -2.05e+63)
tmp = t * (-z / a);
elseif (z <= 4.6e-144)
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, -2.05e+63], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.6e-144], 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 -2.05 \cdot 10^{+63}:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-144}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\end{array}
\end{array}
if z < -2.04999999999999996e63Initial program 89.6%
Taylor expanded in x around 0 65.1%
*-commutative65.1%
associate-*l/71.7%
associate-*r*71.7%
neg-mul-171.7%
distribute-frac-neg71.7%
Simplified71.7%
if -2.04999999999999996e63 < z < 4.6e-144Initial program 95.5%
Taylor expanded in x around inf 68.5%
if 4.6e-144 < z Initial program 89.4%
Taylor expanded in x around 0 86.0%
clear-num86.0%
associate-/r/86.0%
Applied egg-rr86.0%
+-commutative86.0%
associate-*r*86.0%
mul-1-neg86.0%
cancel-sign-sub-inv86.0%
div-inv86.0%
*-commutative86.0%
distribute-rgt-out--89.3%
Applied egg-rr89.3%
Taylor expanded in x around 0 62.0%
mul-1-neg62.0%
*-commutative62.0%
associate-*r/62.9%
distribute-rgt-neg-in62.9%
distribute-neg-frac62.9%
Simplified62.9%
Final simplification67.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= a 7.8e-83) (* y (/ x a)) (* x (/ y a))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 7.8e-83) {
tmp = y * (x / 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 (a <= 7.8d-83) then
tmp = y * (x / 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 (a <= 7.8e-83) {
tmp = y * (x / a);
} else {
tmp = x * (y / a);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if a <= 7.8e-83: tmp = y * (x / a) else: tmp = x * (y / a) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (a <= 7.8e-83) tmp = Float64(y * Float64(x / 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 (a <= 7.8e-83)
tmp = y * (x / 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[a, 7.8e-83], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq 7.8 \cdot 10^{-83}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if a < 7.800000000000001e-83Initial program 92.9%
Taylor expanded in x around inf 50.0%
associate-*l/49.7%
Simplified49.7%
if 7.800000000000001e-83 < a Initial program 90.5%
Taylor expanded in x around 0 90.5%
Taylor expanded in t around 0 46.1%
associate-*r/42.5%
Simplified42.5%
Final simplification47.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* x (/ y a)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
return x * (y / 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 = x * (y / a)
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): return x * (y / a)
x, y = sort([x, y]) function code(x, y, z, t, a) return Float64(x * Float64(y / a)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a)
tmp = x * (y / a);
end
NOTE: x and y 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] = \mathsf{sort}([x, y])\\
\\
x \cdot \frac{y}{a}
\end{array}
Initial program 92.1%
Taylor expanded in x around 0 88.9%
Taylor expanded in t around 0 48.6%
associate-*r/45.5%
Simplified45.5%
Final simplification45.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (/ (* x y) a))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
return (x * y) / 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 = (x * y) / a
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
return (x * y) / a;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): return (x * y) / a
x, y = sort([x, y]) function code(x, y, z, t, a) return Float64(Float64(x * y) / a) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a)
tmp = (x * y) / a;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x \cdot y}{a}
\end{array}
Initial program 92.1%
Taylor expanded in x around inf 48.6%
Final simplification48.6%
(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 2023312
(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))