
(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, 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) (* z t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+277)))
(- (/ x (/ a y)) (/ z (/ a t)))
(/ t_1 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) - (z * t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+277)) {
tmp = (x / (a / y)) - (z / (a / t));
} else {
tmp = t_1 / a;
}
return tmp;
}
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) - (z * t);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e+277)) {
tmp = (x / (a / y)) - (z / (a / t));
} else {
tmp = t_1 / a;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) 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+277): tmp = (x / (a / y)) - (z / (a / t)) else: tmp = t_1 / a return tmp
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(z * t)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+277)) tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t))); else tmp = Float64(t_1 / a); end return tmp end
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) - (z * t);
tmp = 0.0;
if ((t_1 <= -Inf) || ~((t_1 <= 2e+277)))
tmp = (x / (a / y)) - (z / (a / t));
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.
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+277]], $MachinePrecision]], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\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^{+277}\right):\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0 or 2.00000000000000001e277 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 63.1%
div-sub59.7%
associate-/l*74.1%
associate-/l*93.1%
Applied egg-rr93.1%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 2.00000000000000001e277Initial program 99.6%
Final simplification98.1%
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 (/ (- t) (/ a z))))
(if (<= z -1.25e+92)
t_1
(if (<= z -2.3e+59)
(/ x (/ a y))
(if (or (<= z -1.05e+32) (not (<= z 1.25e-148))) t_1 (/ y (/ a x)))))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = -t / (a / z);
double tmp;
if (z <= -1.25e+92) {
tmp = t_1;
} else if (z <= -2.3e+59) {
tmp = x / (a / y);
} else if ((z <= -1.05e+32) || !(z <= 1.25e-148)) {
tmp = t_1;
} else {
tmp = y / (a / x);
}
return tmp;
}
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 = -t / (a / z)
if (z <= (-1.25d+92)) then
tmp = t_1
else if (z <= (-2.3d+59)) then
tmp = x / (a / y)
else if ((z <= (-1.05d+32)) .or. (.not. (z <= 1.25d-148))) then
tmp = t_1
else
tmp = y / (a / x)
end if
code = tmp
end function
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 = -t / (a / z);
double tmp;
if (z <= -1.25e+92) {
tmp = t_1;
} else if (z <= -2.3e+59) {
tmp = x / (a / y);
} else if ((z <= -1.05e+32) || !(z <= 1.25e-148)) {
tmp = t_1;
} else {
tmp = y / (a / x);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = -t / (a / z) tmp = 0 if z <= -1.25e+92: tmp = t_1 elif z <= -2.3e+59: tmp = x / (a / y) elif (z <= -1.05e+32) or not (z <= 1.25e-148): tmp = t_1 else: tmp = y / (a / x) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(-t) / Float64(a / z)) tmp = 0.0 if (z <= -1.25e+92) tmp = t_1; elseif (z <= -2.3e+59) tmp = Float64(x / Float64(a / y)); elseif ((z <= -1.05e+32) || !(z <= 1.25e-148)) tmp = t_1; else tmp = Float64(y / Float64(a / x)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = -t / (a / z);
tmp = 0.0;
if (z <= -1.25e+92)
tmp = t_1;
elseif (z <= -2.3e+59)
tmp = x / (a / y);
elseif ((z <= -1.05e+32) || ~((z <= 1.25e-148)))
tmp = t_1;
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.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.25e+92], t$95$1, If[LessEqual[z, -2.3e+59], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1.05e+32], N[Not[LessEqual[z, 1.25e-148]], $MachinePrecision]], t$95$1, N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \frac{-t}{\frac{a}{z}}\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{+92}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -2.3 \cdot 10^{+59}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{+32} \lor \neg \left(z \leq 1.25 \cdot 10^{-148}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\end{array}
\end{array}
if z < -1.25000000000000005e92 or -2.30000000000000008e59 < z < -1.05e32 or 1.25e-148 < z Initial program 89.8%
Taylor expanded in x around 0 61.3%
mul-1-neg61.3%
associate-/l*65.6%
Simplified65.6%
if -1.25000000000000005e92 < z < -2.30000000000000008e59Initial program 90.2%
Taylor expanded in x around inf 60.5%
associate-*l/60.5%
Simplified60.5%
associate-/r/60.9%
Applied egg-rr60.9%
if -1.05e32 < z < 1.25e-148Initial program 93.3%
Taylor expanded in x around inf 73.6%
associate-*l/76.3%
Simplified76.3%
*-commutative76.3%
clear-num76.3%
un-div-inv77.0%
Applied egg-rr77.0%
Final simplification70.0%
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 (/ (- t) (/ a z))))
(if (<= z -2.2e+90)
t_1
(if (<= z -4.6e+54)
(/ x (/ a y))
(if (<= z -2.3e+31)
t_1
(if (<= z 1.25e-148) (/ y (/ a x)) (* z (/ (- 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 = -t / (a / z);
double tmp;
if (z <= -2.2e+90) {
tmp = t_1;
} else if (z <= -4.6e+54) {
tmp = x / (a / y);
} else if (z <= -2.3e+31) {
tmp = t_1;
} else if (z <= 1.25e-148) {
tmp = y / (a / x);
} else {
tmp = z * (-t / a);
}
return tmp;
}
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 = -t / (a / z)
if (z <= (-2.2d+90)) then
tmp = t_1
else if (z <= (-4.6d+54)) then
tmp = x / (a / y)
else if (z <= (-2.3d+31)) then
tmp = t_1
else if (z <= 1.25d-148) then
tmp = y / (a / x)
else
tmp = z * (-t / a)
end if
code = tmp
end function
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 = -t / (a / z);
double tmp;
if (z <= -2.2e+90) {
tmp = t_1;
} else if (z <= -4.6e+54) {
tmp = x / (a / y);
} else if (z <= -2.3e+31) {
tmp = t_1;
} else if (z <= 1.25e-148) {
tmp = y / (a / x);
} else {
tmp = z * (-t / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = -t / (a / z) tmp = 0 if z <= -2.2e+90: tmp = t_1 elif z <= -4.6e+54: tmp = x / (a / y) elif z <= -2.3e+31: tmp = t_1 elif z <= 1.25e-148: tmp = y / (a / x) else: tmp = z * (-t / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(-t) / Float64(a / z)) tmp = 0.0 if (z <= -2.2e+90) tmp = t_1; elseif (z <= -4.6e+54) tmp = Float64(x / Float64(a / y)); elseif (z <= -2.3e+31) tmp = t_1; elseif (z <= 1.25e-148) tmp = Float64(y / Float64(a / x)); else tmp = Float64(z * Float64(Float64(-t) / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = -t / (a / z);
tmp = 0.0;
if (z <= -2.2e+90)
tmp = t_1;
elseif (z <= -4.6e+54)
tmp = x / (a / y);
elseif (z <= -2.3e+31)
tmp = t_1;
elseif (z <= 1.25e-148)
tmp = y / (a / x);
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.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.2e+90], t$95$1, If[LessEqual[z, -4.6e+54], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.3e+31], t$95$1, If[LessEqual[z, 1.25e-148], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \frac{-t}{\frac{a}{z}}\\
\mathbf{if}\;z \leq -2.2 \cdot 10^{+90}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -4.6 \cdot 10^{+54}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;z \leq -2.3 \cdot 10^{+31}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{-148}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\end{array}
\end{array}
if z < -2.1999999999999999e90 or -4.59999999999999988e54 < z < -2.3e31Initial program 88.3%
Taylor expanded in x around 0 68.8%
mul-1-neg68.8%
associate-/l*78.5%
Simplified78.5%
if -2.1999999999999999e90 < z < -4.59999999999999988e54Initial program 90.2%
Taylor expanded in x around inf 60.5%
associate-*l/60.5%
Simplified60.5%
associate-/r/60.9%
Applied egg-rr60.9%
if -2.3e31 < z < 1.25e-148Initial program 93.3%
Taylor expanded in x around inf 73.6%
associate-*l/76.3%
Simplified76.3%
*-commutative76.3%
clear-num76.3%
un-div-inv77.0%
Applied egg-rr77.0%
if 1.25e-148 < z Initial program 90.8%
div-sub90.8%
associate-/l*90.8%
associate-/l*93.0%
Applied egg-rr93.0%
Taylor expanded in x around 0 56.3%
mul-1-neg56.3%
associate-*l/59.3%
*-commutative59.3%
distribute-lft-neg-in59.3%
Simplified59.3%
Final simplification70.8%
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 (/ (- t) (/ a z))))
(if (<= z -2.1e+90)
t_1
(if (<= z -4.4e+57)
(/ x (/ a y))
(if (<= z -7.5e+32)
t_1
(if (<= z 1.25e-148) (/ y (/ a x)) (* (/ z a) (- t))))))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = -t / (a / z);
double tmp;
if (z <= -2.1e+90) {
tmp = t_1;
} else if (z <= -4.4e+57) {
tmp = x / (a / y);
} else if (z <= -7.5e+32) {
tmp = t_1;
} else if (z <= 1.25e-148) {
tmp = y / (a / x);
} else {
tmp = (z / a) * -t;
}
return tmp;
}
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 = -t / (a / z)
if (z <= (-2.1d+90)) then
tmp = t_1
else if (z <= (-4.4d+57)) then
tmp = x / (a / y)
else if (z <= (-7.5d+32)) then
tmp = t_1
else if (z <= 1.25d-148) then
tmp = y / (a / x)
else
tmp = (z / a) * -t
end if
code = tmp
end function
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 = -t / (a / z);
double tmp;
if (z <= -2.1e+90) {
tmp = t_1;
} else if (z <= -4.4e+57) {
tmp = x / (a / y);
} else if (z <= -7.5e+32) {
tmp = t_1;
} else if (z <= 1.25e-148) {
tmp = y / (a / x);
} else {
tmp = (z / a) * -t;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = -t / (a / z) tmp = 0 if z <= -2.1e+90: tmp = t_1 elif z <= -4.4e+57: tmp = x / (a / y) elif z <= -7.5e+32: tmp = t_1 elif z <= 1.25e-148: tmp = y / (a / x) else: tmp = (z / a) * -t return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(-t) / Float64(a / z)) tmp = 0.0 if (z <= -2.1e+90) tmp = t_1; elseif (z <= -4.4e+57) tmp = Float64(x / Float64(a / y)); elseif (z <= -7.5e+32) tmp = t_1; elseif (z <= 1.25e-148) tmp = Float64(y / Float64(a / x)); else tmp = Float64(Float64(z / a) * Float64(-t)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = -t / (a / z);
tmp = 0.0;
if (z <= -2.1e+90)
tmp = t_1;
elseif (z <= -4.4e+57)
tmp = x / (a / y);
elseif (z <= -7.5e+32)
tmp = t_1;
elseif (z <= 1.25e-148)
tmp = y / (a / x);
else
tmp = (z / a) * -t;
end
tmp_2 = tmp;
end
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[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.1e+90], t$95$1, If[LessEqual[z, -4.4e+57], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -7.5e+32], t$95$1, If[LessEqual[z, 1.25e-148], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * (-t)), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \frac{-t}{\frac{a}{z}}\\
\mathbf{if}\;z \leq -2.1 \cdot 10^{+90}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -4.4 \cdot 10^{+57}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;z \leq -7.5 \cdot 10^{+32}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{-148}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{a} \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -2.09999999999999981e90 or -4.4000000000000001e57 < z < -7.49999999999999959e32Initial program 88.3%
Taylor expanded in x around 0 68.8%
mul-1-neg68.8%
associate-/l*78.5%
Simplified78.5%
if -2.09999999999999981e90 < z < -4.4000000000000001e57Initial program 90.2%
Taylor expanded in x around inf 60.5%
associate-*l/60.5%
Simplified60.5%
associate-/r/60.9%
Applied egg-rr60.9%
if -7.49999999999999959e32 < z < 1.25e-148Initial program 93.3%
Taylor expanded in x around inf 73.6%
associate-*l/76.3%
Simplified76.3%
*-commutative76.3%
clear-num76.3%
un-div-inv77.0%
Applied egg-rr77.0%
if 1.25e-148 < z Initial program 90.8%
Taylor expanded in x around 0 56.3%
mul-1-neg56.3%
*-commutative56.3%
associate-*l/57.7%
distribute-rgt-neg-in57.7%
Simplified57.7%
Final simplification70.3%
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 (<= (* z t) -2e+193) (/ z (/ (- a) t)) (if (<= (* z t) 5e+260) (/ (- (* x y) (* z t)) a) (* z (/ (- 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 ((z * t) <= -2e+193) {
tmp = z / (-a / t);
} else if ((z * t) <= 5e+260) {
tmp = ((x * y) - (z * t)) / 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.
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+193)) then
tmp = z / (-a / t)
else if ((z * t) <= 5d+260) then
tmp = ((x * y) - (z * t)) / a
else
tmp = z * (-t / a)
end if
code = tmp
end function
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 ((z * t) <= -2e+193) {
tmp = z / (-a / t);
} else if ((z * t) <= 5e+260) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = z * (-t / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (z * t) <= -2e+193: tmp = z / (-a / t) elif (z * t) <= 5e+260: tmp = ((x * y) - (z * t)) / a else: tmp = z * (-t / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(z * t) <= -2e+193) tmp = Float64(z / Float64(Float64(-a) / t)); elseif (Float64(z * t) <= 5e+260) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / 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])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((z * t) <= -2e+193)
tmp = z / (-a / t);
elseif ((z * t) <= 5e+260)
tmp = ((x * y) - (z * t)) / 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. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(z * t), $MachinePrecision], -2e+193], N[(z / N[((-a) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+260], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $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])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+193}:\\
\;\;\;\;\frac{z}{\frac{-a}{t}}\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+260}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000013e193Initial program 61.1%
div-sub55.2%
associate-/l*55.2%
associate-/l*94.1%
Applied egg-rr94.1%
Taylor expanded in x around 0 61.1%
mul-1-neg61.1%
associate-*l/99.6%
*-commutative99.6%
distribute-lft-neg-in99.6%
Simplified99.6%
add-sqr-sqrt70.1%
sqrt-unprod26.5%
sqr-neg26.5%
sqrt-unprod0.0%
add-sqr-sqrt0.4%
clear-num0.4%
div-inv0.4%
frac-2neg0.4%
add-sqr-sqrt0.3%
sqrt-unprod18.6%
sqr-neg18.6%
sqrt-unprod29.4%
add-sqr-sqrt100.0%
distribute-neg-frac100.0%
Applied egg-rr100.0%
if -2.00000000000000013e193 < (*.f64 z t) < 4.9999999999999996e260Initial program 95.9%
if 4.9999999999999996e260 < (*.f64 z t) Initial program 58.3%
div-sub45.8%
associate-/l*46.0%
associate-/l*87.1%
Applied egg-rr87.1%
Taylor expanded in x around 0 58.5%
mul-1-neg58.5%
associate-*l/98.9%
*-commutative98.9%
distribute-lft-neg-in98.9%
Simplified98.9%
Final simplification96.3%
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 (<= z -1.25e+76) (/ x (/ a y)) (* y (/ x 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 (z <= -1.25e+76) {
tmp = x / (a / y);
} else {
tmp = y * (x / a);
}
return tmp;
}
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 (z <= (-1.25d+76)) then
tmp = x / (a / y)
else
tmp = y * (x / a)
end if
code = tmp
end function
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 (z <= -1.25e+76) {
tmp = x / (a / y);
} else {
tmp = y * (x / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if z <= -1.25e+76: tmp = x / (a / y) else: tmp = y * (x / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.25e+76) tmp = Float64(x / Float64(a / y)); else tmp = Float64(y * Float64(x / a)); end return tmp end
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 (z <= -1.25e+76)
tmp = x / (a / y);
else
tmp = y * (x / a);
end
tmp_2 = tmp;
end
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[z, -1.25e+76], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+76}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if z < -1.24999999999999998e76Initial program 86.7%
Taylor expanded in x around inf 25.6%
associate-*l/22.1%
Simplified22.1%
associate-/r/27.6%
Applied egg-rr27.6%
if -1.24999999999999998e76 < z Initial program 92.4%
Taylor expanded in x around inf 58.3%
associate-*l/59.5%
Simplified59.5%
Final simplification53.2%
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 (<= z -1.15e+90) (/ x (/ a y)) (/ y (/ a x))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.15e+90) {
tmp = x / (a / y);
} else {
tmp = y / (a / x);
}
return tmp;
}
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 (z <= (-1.15d+90)) then
tmp = x / (a / y)
else
tmp = y / (a / x)
end if
code = tmp
end function
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 (z <= -1.15e+90) {
tmp = x / (a / y);
} else {
tmp = y / (a / x);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if z <= -1.15e+90: tmp = x / (a / y) else: tmp = y / (a / x) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.15e+90) tmp = Float64(x / Float64(a / y)); else tmp = Float64(y / Float64(a / x)); end return tmp end
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 (z <= -1.15e+90)
tmp = x / (a / y);
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. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.15e+90], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+90}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\end{array}
\end{array}
if z < -1.15e90Initial program 86.4%
Taylor expanded in x around inf 26.1%
associate-*l/22.5%
Simplified22.5%
associate-/r/28.1%
Applied egg-rr28.1%
if -1.15e90 < z Initial program 92.4%
Taylor expanded in x around inf 58.1%
associate-*l/59.2%
Simplified59.2%
*-commutative59.2%
clear-num59.0%
un-div-inv59.3%
Applied egg-rr59.3%
Final simplification53.2%
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);
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.
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;
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]) def code(x, y, z, t, a): return y * (x / 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])){:}
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. 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])\\
\\
y \cdot \frac{x}{a}
\end{array}
Initial program 91.2%
Taylor expanded in x around inf 51.8%
associate-*l/52.1%
Simplified52.1%
Final simplification52.1%
(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 2024019
(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))