
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
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 * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y \cdot z}{t - a \cdot z}
\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 z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
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 * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y \cdot z}{t - a \cdot z}
\end{array}
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.6e+188) (not (<= z 6e+129))) (/ (- y (/ x z)) a) (/ (- (* z y) x) (- (* z a) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.6e+188) || !(z <= 6e+129)) {
tmp = (y - (x / z)) / a;
} else {
tmp = ((z * y) - x) / ((z * a) - t);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-2.6d+188)) .or. (.not. (z <= 6d+129))) then
tmp = (y - (x / z)) / a
else
tmp = ((z * y) - x) / ((z * a) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.6e+188) || !(z <= 6e+129)) {
tmp = (y - (x / z)) / a;
} else {
tmp = ((z * y) - x) / ((z * a) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.6e+188) or not (z <= 6e+129): tmp = (y - (x / z)) / a else: tmp = ((z * y) - x) / ((z * a) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.6e+188) || !(z <= 6e+129)) tmp = Float64(Float64(y - Float64(x / z)) / a); else tmp = Float64(Float64(Float64(z * y) - x) / Float64(Float64(z * a) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.6e+188) || ~((z <= 6e+129))) tmp = (y - (x / z)) / a; else tmp = ((z * y) - x) / ((z * a) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.6e+188], N[Not[LessEqual[z, 6e+129]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(N[(z * y), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{+188} \lor \neg \left(z \leq 6 \cdot 10^{+129}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot y - x}{z \cdot a - t}\\
\end{array}
\end{array}
if z < -2.59999999999999987e188 or 6.0000000000000006e129 < z Initial program 52.8%
*-commutative52.8%
Simplified52.8%
Taylor expanded in a around -inf 56.0%
mul-1-neg56.0%
associate--l+56.0%
associate-/l*64.0%
Simplified64.0%
Taylor expanded in t around 0 88.2%
if -2.59999999999999987e188 < z < 6.0000000000000006e129Initial program 97.4%
Final simplification95.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ z (- t)))))
(if (<= z -1.3e+15)
(/ y a)
(if (<= z -1.62e-127)
t_1
(if (<= z 6.5e-35)
(/ x t)
(if (<= z 8e+44)
t_1
(if (<= z 3.3e+111)
(/ (/ x a) (- z))
(if (<= z 4.4e+124) t_1 (/ y a)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z / -t);
double tmp;
if (z <= -1.3e+15) {
tmp = y / a;
} else if (z <= -1.62e-127) {
tmp = t_1;
} else if (z <= 6.5e-35) {
tmp = x / t;
} else if (z <= 8e+44) {
tmp = t_1;
} else if (z <= 3.3e+111) {
tmp = (x / a) / -z;
} else if (z <= 4.4e+124) {
tmp = t_1;
} else {
tmp = y / a;
}
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 * (z / -t)
if (z <= (-1.3d+15)) then
tmp = y / a
else if (z <= (-1.62d-127)) then
tmp = t_1
else if (z <= 6.5d-35) then
tmp = x / t
else if (z <= 8d+44) then
tmp = t_1
else if (z <= 3.3d+111) then
tmp = (x / a) / -z
else if (z <= 4.4d+124) then
tmp = t_1
else
tmp = y / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z / -t);
double tmp;
if (z <= -1.3e+15) {
tmp = y / a;
} else if (z <= -1.62e-127) {
tmp = t_1;
} else if (z <= 6.5e-35) {
tmp = x / t;
} else if (z <= 8e+44) {
tmp = t_1;
} else if (z <= 3.3e+111) {
tmp = (x / a) / -z;
} else if (z <= 4.4e+124) {
tmp = t_1;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (z / -t) tmp = 0 if z <= -1.3e+15: tmp = y / a elif z <= -1.62e-127: tmp = t_1 elif z <= 6.5e-35: tmp = x / t elif z <= 8e+44: tmp = t_1 elif z <= 3.3e+111: tmp = (x / a) / -z elif z <= 4.4e+124: tmp = t_1 else: tmp = y / a return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z / Float64(-t))) tmp = 0.0 if (z <= -1.3e+15) tmp = Float64(y / a); elseif (z <= -1.62e-127) tmp = t_1; elseif (z <= 6.5e-35) tmp = Float64(x / t); elseif (z <= 8e+44) tmp = t_1; elseif (z <= 3.3e+111) tmp = Float64(Float64(x / a) / Float64(-z)); elseif (z <= 4.4e+124) tmp = t_1; else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (z / -t); tmp = 0.0; if (z <= -1.3e+15) tmp = y / a; elseif (z <= -1.62e-127) tmp = t_1; elseif (z <= 6.5e-35) tmp = x / t; elseif (z <= 8e+44) tmp = t_1; elseif (z <= 3.3e+111) tmp = (x / a) / -z; elseif (z <= 4.4e+124) tmp = t_1; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z / (-t)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.3e+15], N[(y / a), $MachinePrecision], If[LessEqual[z, -1.62e-127], t$95$1, If[LessEqual[z, 6.5e-35], N[(x / t), $MachinePrecision], If[LessEqual[z, 8e+44], t$95$1, If[LessEqual[z, 3.3e+111], N[(N[(x / a), $MachinePrecision] / (-z)), $MachinePrecision], If[LessEqual[z, 4.4e+124], t$95$1, N[(y / a), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{-t}\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{+15}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -1.62 \cdot 10^{-127}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-35}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{+111}:\\
\;\;\;\;\frac{\frac{x}{a}}{-z}\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+124}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.3e15 or 4.4000000000000002e124 < z Initial program 69.8%
*-commutative69.8%
Simplified69.8%
Taylor expanded in z around inf 61.7%
if -1.3e15 < z < -1.61999999999999993e-127 or 6.4999999999999999e-35 < z < 8.0000000000000007e44 or 3.3000000000000001e111 < z < 4.4000000000000002e124Initial program 98.1%
*-commutative98.1%
Simplified98.1%
Taylor expanded in t around inf 72.0%
Taylor expanded in x around 0 48.5%
associate-*r*48.5%
neg-mul-148.5%
Simplified48.5%
Taylor expanded in y around 0 48.5%
mul-1-neg48.5%
associate-*r/50.1%
distribute-rgt-neg-in50.1%
distribute-frac-neg50.1%
Simplified50.1%
if -1.61999999999999993e-127 < z < 6.4999999999999999e-35Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 64.7%
if 8.0000000000000007e44 < z < 3.3000000000000001e111Initial program 92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in t around 0 63.5%
associate-*r/63.5%
neg-mul-163.5%
neg-sub063.5%
sub-neg63.5%
distribute-rgt-neg-out63.5%
+-commutative63.5%
associate--r+63.5%
neg-sub063.5%
distribute-rgt-neg-out63.5%
remove-double-neg63.5%
*-commutative63.5%
Simplified63.5%
Taylor expanded in y around 0 55.0%
mul-1-neg55.0%
associate-/r*55.0%
distribute-neg-frac255.0%
Simplified55.0%
Final simplification59.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ z (- t)))))
(if (<= z -4.4e+14)
(/ y a)
(if (<= z -1.62e-127)
t_1
(if (<= z 1.55e-39)
(/ x t)
(if (<= z 1.66e+47)
t_1
(if (<= z 1.16e+114)
(/ (/ x z) (- a))
(if (<= z 1.45e+125) t_1 (/ y a)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z / -t);
double tmp;
if (z <= -4.4e+14) {
tmp = y / a;
} else if (z <= -1.62e-127) {
tmp = t_1;
} else if (z <= 1.55e-39) {
tmp = x / t;
} else if (z <= 1.66e+47) {
tmp = t_1;
} else if (z <= 1.16e+114) {
tmp = (x / z) / -a;
} else if (z <= 1.45e+125) {
tmp = t_1;
} else {
tmp = y / a;
}
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 * (z / -t)
if (z <= (-4.4d+14)) then
tmp = y / a
else if (z <= (-1.62d-127)) then
tmp = t_1
else if (z <= 1.55d-39) then
tmp = x / t
else if (z <= 1.66d+47) then
tmp = t_1
else if (z <= 1.16d+114) then
tmp = (x / z) / -a
else if (z <= 1.45d+125) then
tmp = t_1
else
tmp = y / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z / -t);
double tmp;
if (z <= -4.4e+14) {
tmp = y / a;
} else if (z <= -1.62e-127) {
tmp = t_1;
} else if (z <= 1.55e-39) {
tmp = x / t;
} else if (z <= 1.66e+47) {
tmp = t_1;
} else if (z <= 1.16e+114) {
tmp = (x / z) / -a;
} else if (z <= 1.45e+125) {
tmp = t_1;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (z / -t) tmp = 0 if z <= -4.4e+14: tmp = y / a elif z <= -1.62e-127: tmp = t_1 elif z <= 1.55e-39: tmp = x / t elif z <= 1.66e+47: tmp = t_1 elif z <= 1.16e+114: tmp = (x / z) / -a elif z <= 1.45e+125: tmp = t_1 else: tmp = y / a return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z / Float64(-t))) tmp = 0.0 if (z <= -4.4e+14) tmp = Float64(y / a); elseif (z <= -1.62e-127) tmp = t_1; elseif (z <= 1.55e-39) tmp = Float64(x / t); elseif (z <= 1.66e+47) tmp = t_1; elseif (z <= 1.16e+114) tmp = Float64(Float64(x / z) / Float64(-a)); elseif (z <= 1.45e+125) tmp = t_1; else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (z / -t); tmp = 0.0; if (z <= -4.4e+14) tmp = y / a; elseif (z <= -1.62e-127) tmp = t_1; elseif (z <= 1.55e-39) tmp = x / t; elseif (z <= 1.66e+47) tmp = t_1; elseif (z <= 1.16e+114) tmp = (x / z) / -a; elseif (z <= 1.45e+125) tmp = t_1; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z / (-t)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.4e+14], N[(y / a), $MachinePrecision], If[LessEqual[z, -1.62e-127], t$95$1, If[LessEqual[z, 1.55e-39], N[(x / t), $MachinePrecision], If[LessEqual[z, 1.66e+47], t$95$1, If[LessEqual[z, 1.16e+114], N[(N[(x / z), $MachinePrecision] / (-a)), $MachinePrecision], If[LessEqual[z, 1.45e+125], t$95$1, N[(y / a), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{-t}\\
\mathbf{if}\;z \leq -4.4 \cdot 10^{+14}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -1.62 \cdot 10^{-127}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-39}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 1.66 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.16 \cdot 10^{+114}:\\
\;\;\;\;\frac{\frac{x}{z}}{-a}\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{+125}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -4.4e14 or 1.44999999999999997e125 < z Initial program 69.8%
*-commutative69.8%
Simplified69.8%
Taylor expanded in z around inf 61.7%
if -4.4e14 < z < -1.61999999999999993e-127 or 1.54999999999999985e-39 < z < 1.6599999999999999e47 or 1.15999999999999994e114 < z < 1.44999999999999997e125Initial program 98.1%
*-commutative98.1%
Simplified98.1%
Taylor expanded in t around inf 72.0%
Taylor expanded in x around 0 48.5%
associate-*r*48.5%
neg-mul-148.5%
Simplified48.5%
Taylor expanded in y around 0 48.5%
mul-1-neg48.5%
associate-*r/50.1%
distribute-rgt-neg-in50.1%
distribute-frac-neg50.1%
Simplified50.1%
if -1.61999999999999993e-127 < z < 1.54999999999999985e-39Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 64.7%
if 1.6599999999999999e47 < z < 1.15999999999999994e114Initial program 92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in a around -inf 61.7%
mul-1-neg61.7%
associate--l+61.7%
associate-/l*61.7%
Simplified61.7%
Taylor expanded in t around 0 63.5%
Taylor expanded in x around inf 55.0%
Final simplification59.4%
(FPCore (x y z t a)
:precision binary64
(if (<= a -4.6e+57)
(/ y a)
(if (<= a 1.4e-17)
(/ (- x (* z y)) t)
(if (or (<= a 2.8e+142) (not (<= a 9.4e+194)))
(/ x (- t (* z a)))
(/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.6e+57) {
tmp = y / a;
} else if (a <= 1.4e-17) {
tmp = (x - (z * y)) / t;
} else if ((a <= 2.8e+142) || !(a <= 9.4e+194)) {
tmp = x / (t - (z * a));
} else {
tmp = y / a;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-4.6d+57)) then
tmp = y / a
else if (a <= 1.4d-17) then
tmp = (x - (z * y)) / t
else if ((a <= 2.8d+142) .or. (.not. (a <= 9.4d+194))) then
tmp = x / (t - (z * a))
else
tmp = y / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.6e+57) {
tmp = y / a;
} else if (a <= 1.4e-17) {
tmp = (x - (z * y)) / t;
} else if ((a <= 2.8e+142) || !(a <= 9.4e+194)) {
tmp = x / (t - (z * a));
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -4.6e+57: tmp = y / a elif a <= 1.4e-17: tmp = (x - (z * y)) / t elif (a <= 2.8e+142) or not (a <= 9.4e+194): tmp = x / (t - (z * a)) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.6e+57) tmp = Float64(y / a); elseif (a <= 1.4e-17) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif ((a <= 2.8e+142) || !(a <= 9.4e+194)) tmp = Float64(x / Float64(t - Float64(z * a))); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -4.6e+57) tmp = y / a; elseif (a <= 1.4e-17) tmp = (x - (z * y)) / t; elseif ((a <= 2.8e+142) || ~((a <= 9.4e+194))) tmp = x / (t - (z * a)); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.6e+57], N[(y / a), $MachinePrecision], If[LessEqual[a, 1.4e-17], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[Or[LessEqual[a, 2.8e+142], N[Not[LessEqual[a, 9.4e+194]], $MachinePrecision]], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.6 \cdot 10^{+57}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;a \leq 1.4 \cdot 10^{-17}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;a \leq 2.8 \cdot 10^{+142} \lor \neg \left(a \leq 9.4 \cdot 10^{+194}\right):\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if a < -4.5999999999999998e57 or 2.8e142 < a < 9.39999999999999945e194Initial program 72.9%
*-commutative72.9%
Simplified72.9%
Taylor expanded in z around inf 66.1%
if -4.5999999999999998e57 < a < 1.3999999999999999e-17Initial program 96.4%
*-commutative96.4%
Simplified96.4%
Taylor expanded in t around inf 73.3%
if 1.3999999999999999e-17 < a < 2.8e142 or 9.39999999999999945e194 < a Initial program 85.2%
*-commutative85.2%
Simplified85.2%
Taylor expanded in x around inf 65.6%
*-commutative65.6%
Simplified65.6%
Final simplification70.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ x (- t (* z a)))))
(if (<= z -1.7e+97)
(/ y a)
(if (<= z 2.15e-33)
t_1
(if (<= z 2e+41) (* y (/ z (- t))) (if (<= z 7.8e+127) t_1 (/ y a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x / (t - (z * a));
double tmp;
if (z <= -1.7e+97) {
tmp = y / a;
} else if (z <= 2.15e-33) {
tmp = t_1;
} else if (z <= 2e+41) {
tmp = y * (z / -t);
} else if (z <= 7.8e+127) {
tmp = t_1;
} else {
tmp = y / a;
}
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 = x / (t - (z * a))
if (z <= (-1.7d+97)) then
tmp = y / a
else if (z <= 2.15d-33) then
tmp = t_1
else if (z <= 2d+41) then
tmp = y * (z / -t)
else if (z <= 7.8d+127) then
tmp = t_1
else
tmp = y / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x / (t - (z * a));
double tmp;
if (z <= -1.7e+97) {
tmp = y / a;
} else if (z <= 2.15e-33) {
tmp = t_1;
} else if (z <= 2e+41) {
tmp = y * (z / -t);
} else if (z <= 7.8e+127) {
tmp = t_1;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x / (t - (z * a)) tmp = 0 if z <= -1.7e+97: tmp = y / a elif z <= 2.15e-33: tmp = t_1 elif z <= 2e+41: tmp = y * (z / -t) elif z <= 7.8e+127: tmp = t_1 else: tmp = y / a return tmp
function code(x, y, z, t, a) t_1 = Float64(x / Float64(t - Float64(z * a))) tmp = 0.0 if (z <= -1.7e+97) tmp = Float64(y / a); elseif (z <= 2.15e-33) tmp = t_1; elseif (z <= 2e+41) tmp = Float64(y * Float64(z / Float64(-t))); elseif (z <= 7.8e+127) tmp = t_1; else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x / (t - (z * a)); tmp = 0.0; if (z <= -1.7e+97) tmp = y / a; elseif (z <= 2.15e-33) tmp = t_1; elseif (z <= 2e+41) tmp = y * (z / -t); elseif (z <= 7.8e+127) tmp = t_1; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.7e+97], N[(y / a), $MachinePrecision], If[LessEqual[z, 2.15e-33], t$95$1, If[LessEqual[z, 2e+41], N[(y * N[(z / (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.8e+127], t$95$1, N[(y / a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{t - z \cdot a}\\
\mathbf{if}\;z \leq -1.7 \cdot 10^{+97}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{-33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+41}:\\
\;\;\;\;y \cdot \frac{z}{-t}\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{+127}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.70000000000000005e97 or 7.79999999999999962e127 < z Initial program 63.1%
*-commutative63.1%
Simplified63.1%
Taylor expanded in z around inf 67.9%
if -1.70000000000000005e97 < z < 2.15000000000000015e-33 or 2.00000000000000001e41 < z < 7.79999999999999962e127Initial program 98.6%
*-commutative98.6%
Simplified98.6%
Taylor expanded in x around inf 67.0%
*-commutative67.0%
Simplified67.0%
if 2.15000000000000015e-33 < z < 2.00000000000000001e41Initial program 99.3%
*-commutative99.3%
Simplified99.3%
Taylor expanded in t around inf 62.0%
Taylor expanded in x around 0 57.2%
associate-*r*57.2%
neg-mul-157.2%
Simplified57.2%
Taylor expanded in y around 0 57.2%
mul-1-neg57.2%
associate-*r/57.4%
distribute-rgt-neg-in57.4%
distribute-frac-neg57.4%
Simplified57.4%
Final simplification66.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -7.5e+49) (not (<= a 8000000.0))) (/ (- y (/ x z)) a) (/ (- x (* z y)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -7.5e+49) || !(a <= 8000000.0)) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (z * y)) / t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-7.5d+49)) .or. (.not. (a <= 8000000.0d0))) then
tmp = (y - (x / z)) / a
else
tmp = (x - (z * y)) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -7.5e+49) || !(a <= 8000000.0)) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (z * y)) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -7.5e+49) or not (a <= 8000000.0): tmp = (y - (x / z)) / a else: tmp = (x - (z * y)) / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -7.5e+49) || !(a <= 8000000.0)) tmp = Float64(Float64(y - Float64(x / z)) / a); else tmp = Float64(Float64(x - Float64(z * y)) / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -7.5e+49) || ~((a <= 8000000.0))) tmp = (y - (x / z)) / a; else tmp = (x - (z * y)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -7.5e+49], N[Not[LessEqual[a, 8000000.0]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.5 \cdot 10^{+49} \lor \neg \left(a \leq 8000000\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\end{array}
\end{array}
if a < -7.4999999999999995e49 or 8e6 < a Initial program 78.5%
*-commutative78.5%
Simplified78.5%
Taylor expanded in a around -inf 46.6%
mul-1-neg46.6%
associate--l+46.6%
associate-/l*53.8%
Simplified53.8%
Taylor expanded in t around 0 72.9%
if -7.4999999999999995e49 < a < 8e6Initial program 96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in t around inf 73.5%
Final simplification73.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -62000000000000.0) (not (<= z 1.45e-6))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -62000000000000.0) || !(z <= 1.45e-6)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-62000000000000.0d0)) .or. (.not. (z <= 1.45d-6))) then
tmp = y / a
else
tmp = x / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -62000000000000.0) || !(z <= 1.45e-6)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -62000000000000.0) or not (z <= 1.45e-6): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -62000000000000.0) || !(z <= 1.45e-6)) tmp = Float64(y / a); else tmp = Float64(x / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -62000000000000.0) || ~((z <= 1.45e-6))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -62000000000000.0], N[Not[LessEqual[z, 1.45e-6]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -62000000000000 \lor \neg \left(z \leq 1.45 \cdot 10^{-6}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -6.2e13 or 1.4500000000000001e-6 < z Initial program 75.7%
*-commutative75.7%
Simplified75.7%
Taylor expanded in z around inf 52.8%
if -6.2e13 < z < 1.4500000000000001e-6Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 53.6%
Final simplification53.3%
(FPCore (x y z t a) :precision binary64 (/ x t))
double code(double x, double y, double z, double t, double a) {
return x / t;
}
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 / t
end function
public static double code(double x, double y, double z, double t, double a) {
return x / t;
}
def code(x, y, z, t, a): return x / t
function code(x, y, z, t, a) return Float64(x / t) end
function tmp = code(x, y, z, t, a) tmp = x / t; end
code[x_, y_, z_, t_, a_] := N[(x / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{t}
\end{array}
Initial program 88.7%
*-commutative88.7%
Simplified88.7%
Taylor expanded in z around 0 36.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* a z))) (t_2 (- (/ x t_1) (/ y (- (/ t z) a)))))
(if (< z -32113435955957344.0)
t_2
(if (< z 3.5139522372978296e-86) (* (- x (* y z)) (/ 1.0 t_1)) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = t - (a * z)
t_2 = (x / t_1) - (y / ((t / z) - a))
if (z < (-32113435955957344.0d0)) then
tmp = t_2
else if (z < 3.5139522372978296d-86) then
tmp = (x - (y * z)) * (1.0d0 / t_1)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - (a * z) t_2 = (x / t_1) - (y / ((t / z) - a)) tmp = 0 if z < -32113435955957344.0: tmp = t_2 elif z < 3.5139522372978296e-86: tmp = (x - (y * z)) * (1.0 / t_1) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(a * z)) t_2 = Float64(Float64(x / t_1) - Float64(y / Float64(Float64(t / z) - a))) tmp = 0.0 if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = Float64(Float64(x - Float64(y * z)) * Float64(1.0 / t_1)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - (a * z); t_2 = (x / t_1) - (y / ((t / z) - a)); tmp = 0.0; if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = (x - (y * z)) * (1.0 / t_1); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / t$95$1), $MachinePrecision] - N[(y / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -32113435955957344.0], t$95$2, If[Less[z, 3.5139522372978296e-86], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - a \cdot z\\
t_2 := \frac{x}{t\_1} - \frac{y}{\frac{t}{z} - a}\\
\mathbf{if}\;z < -32113435955957344:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z < 3.5139522372978296 \cdot 10^{-86}:\\
\;\;\;\;\left(x - y \cdot z\right) \cdot \frac{1}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2024089
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:alt
(if (< z -32113435955957344.0) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))) (if (< z 3.5139522372978296e-86) (* (- x (* y z)) (/ 1.0 (- t (* a z)))) (- (/ x (- t (* a z))) (/ y (- (/ t z) a)))))
(/ (- x (* y z)) (- t (* a z))))