
(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.8e+147) (not (<= z 8.2e+123))) (/ (- y (/ x z)) a) (/ (- x (* z y)) (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.8e+147) || !(z <= 8.2e+123)) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (z * y)) / (t - (z * 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 ((z <= (-2.8d+147)) .or. (.not. (z <= 8.2d+123))) then
tmp = (y - (x / z)) / a
else
tmp = (x - (z * y)) / (t - (z * a))
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.8e+147) || !(z <= 8.2e+123)) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (z * y)) / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.8e+147) or not (z <= 8.2e+123): tmp = (y - (x / z)) / a else: tmp = (x - (z * y)) / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.8e+147) || !(z <= 8.2e+123)) tmp = Float64(Float64(y - Float64(x / z)) / a); else tmp = Float64(Float64(x - Float64(z * y)) / Float64(t - Float64(z * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.8e+147) || ~((z <= 8.2e+123))) tmp = (y - (x / z)) / a; else tmp = (x - (z * y)) / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.8e+147], N[Not[LessEqual[z, 8.2e+123]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+147} \lor \neg \left(z \leq 8.2 \cdot 10^{+123}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -2.8000000000000001e147 or 8.19999999999999979e123 < z Initial program 58.1%
*-commutative58.1%
Simplified58.1%
Taylor expanded in x around inf 50.1%
Simplified70.2%
Taylor expanded in a around inf 86.1%
mul-1-neg86.1%
sub-neg86.1%
Simplified86.1%
if -2.8000000000000001e147 < z < 8.19999999999999979e123Initial program 96.8%
Final simplification94.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- x (* z y)) t)))
(if (<= z -1.8e+147)
(/ y a)
(if (<= z -1.9e-140)
t_1
(if (<= z 3.1e-58)
(/ x (- t (* z a)))
(if (<= z 7.5e+123) t_1 (/ y a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (z * y)) / t;
double tmp;
if (z <= -1.8e+147) {
tmp = y / a;
} else if (z <= -1.9e-140) {
tmp = t_1;
} else if (z <= 3.1e-58) {
tmp = x / (t - (z * a));
} else if (z <= 7.5e+123) {
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 - (z * y)) / t
if (z <= (-1.8d+147)) then
tmp = y / a
else if (z <= (-1.9d-140)) then
tmp = t_1
else if (z <= 3.1d-58) then
tmp = x / (t - (z * a))
else if (z <= 7.5d+123) 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 - (z * y)) / t;
double tmp;
if (z <= -1.8e+147) {
tmp = y / a;
} else if (z <= -1.9e-140) {
tmp = t_1;
} else if (z <= 3.1e-58) {
tmp = x / (t - (z * a));
} else if (z <= 7.5e+123) {
tmp = t_1;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x - (z * y)) / t tmp = 0 if z <= -1.8e+147: tmp = y / a elif z <= -1.9e-140: tmp = t_1 elif z <= 3.1e-58: tmp = x / (t - (z * a)) elif z <= 7.5e+123: tmp = t_1 else: tmp = y / a return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x - Float64(z * y)) / t) tmp = 0.0 if (z <= -1.8e+147) tmp = Float64(y / a); elseif (z <= -1.9e-140) tmp = t_1; elseif (z <= 3.1e-58) tmp = Float64(x / Float64(t - Float64(z * a))); elseif (z <= 7.5e+123) tmp = t_1; else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x - (z * y)) / t; tmp = 0.0; if (z <= -1.8e+147) tmp = y / a; elseif (z <= -1.9e-140) tmp = t_1; elseif (z <= 3.1e-58) tmp = x / (t - (z * a)); elseif (z <= 7.5e+123) tmp = t_1; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[z, -1.8e+147], N[(y / a), $MachinePrecision], If[LessEqual[z, -1.9e-140], t$95$1, If[LessEqual[z, 3.1e-58], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.5e+123], t$95$1, N[(y / a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - z \cdot y}{t}\\
\mathbf{if}\;z \leq -1.8 \cdot 10^{+147}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -1.9 \cdot 10^{-140}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{-58}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+123}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.8000000000000001e147 or 7.4999999999999999e123 < z Initial program 58.1%
*-commutative58.1%
Simplified58.1%
Taylor expanded in z around inf 70.8%
if -1.8000000000000001e147 < z < -1.89999999999999999e-140 or 3.0999999999999999e-58 < z < 7.4999999999999999e123Initial program 93.9%
*-commutative93.9%
Simplified93.9%
Taylor expanded in t around inf 62.8%
*-commutative62.8%
Simplified62.8%
if -1.89999999999999999e-140 < z < 3.0999999999999999e-58Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 82.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.12e+17) (/ y a) (if (<= z 1.95e-8) (/ x t) (if (<= z 5.9e+63) (* y (/ z (- t))) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.12e+17) {
tmp = y / a;
} else if (z <= 1.95e-8) {
tmp = x / t;
} else if (z <= 5.9e+63) {
tmp = y * (z / -t);
} 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 (z <= (-1.12d+17)) then
tmp = y / a
else if (z <= 1.95d-8) then
tmp = x / t
else if (z <= 5.9d+63) then
tmp = y * (z / -t)
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 (z <= -1.12e+17) {
tmp = y / a;
} else if (z <= 1.95e-8) {
tmp = x / t;
} else if (z <= 5.9e+63) {
tmp = y * (z / -t);
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.12e+17: tmp = y / a elif z <= 1.95e-8: tmp = x / t elif z <= 5.9e+63: tmp = y * (z / -t) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.12e+17) tmp = Float64(y / a); elseif (z <= 1.95e-8) tmp = Float64(x / t); elseif (z <= 5.9e+63) tmp = Float64(y * Float64(z / Float64(-t))); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.12e+17) tmp = y / a; elseif (z <= 1.95e-8) tmp = x / t; elseif (z <= 5.9e+63) tmp = y * (z / -t); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.12e+17], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.95e-8], N[(x / t), $MachinePrecision], If[LessEqual[z, 5.9e+63], N[(y * N[(z / (-t)), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.12 \cdot 10^{+17}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{-8}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 5.9 \cdot 10^{+63}:\\
\;\;\;\;y \cdot \frac{z}{-t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.12e17 or 5.90000000000000029e63 < z Initial program 70.4%
*-commutative70.4%
Simplified70.4%
Taylor expanded in z around inf 56.3%
if -1.12e17 < z < 1.94999999999999992e-8Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 62.0%
if 1.94999999999999992e-8 < z < 5.90000000000000029e63Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in x around 0 81.1%
mul-1-neg81.1%
associate-/l*81.1%
distribute-rgt-neg-in81.1%
sub-neg81.1%
mul-1-neg81.1%
+-commutative81.1%
mul-1-neg81.1%
distribute-rgt-neg-in81.1%
fma-undefine81.1%
distribute-neg-frac281.1%
neg-sub081.1%
fma-undefine81.1%
distribute-rgt-neg-in81.1%
distribute-lft-neg-in81.1%
*-commutative81.1%
associate--r+81.1%
neg-sub081.1%
distribute-rgt-neg-out81.1%
remove-double-neg81.1%
*-commutative81.1%
Simplified81.1%
Taylor expanded in z around 0 61.0%
associate-*r/61.0%
neg-mul-161.0%
Simplified61.0%
Final simplification59.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -4.2e+18) (not (<= a 6e-26))) (/ (- y (/ x z)) a) (/ (- x (* z y)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -4.2e+18) || !(a <= 6e-26)) {
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 <= (-4.2d+18)) .or. (.not. (a <= 6d-26))) 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 <= -4.2e+18) || !(a <= 6e-26)) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (z * y)) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -4.2e+18) or not (a <= 6e-26): 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 <= -4.2e+18) || !(a <= 6e-26)) 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 <= -4.2e+18) || ~((a <= 6e-26))) 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, -4.2e+18], N[Not[LessEqual[a, 6e-26]], $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 -4.2 \cdot 10^{+18} \lor \neg \left(a \leq 6 \cdot 10^{-26}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\end{array}
\end{array}
if a < -4.2e18 or 6.00000000000000023e-26 < a Initial program 82.3%
*-commutative82.3%
Simplified82.3%
Taylor expanded in x around inf 78.4%
Simplified74.8%
Taylor expanded in a around inf 71.8%
mul-1-neg71.8%
sub-neg71.8%
Simplified71.8%
if -4.2e18 < a < 6.00000000000000023e-26Initial program 92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in t around inf 80.9%
*-commutative80.9%
Simplified80.9%
Final simplification76.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -8.8e+74) (not (<= z 7.5e+123))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -8.8e+74) || !(z <= 7.5e+123)) {
tmp = y / a;
} else {
tmp = x / (t - (z * 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 ((z <= (-8.8d+74)) .or. (.not. (z <= 7.5d+123))) then
tmp = y / a
else
tmp = x / (t - (z * a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -8.8e+74) || !(z <= 7.5e+123)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -8.8e+74) or not (z <= 7.5e+123): tmp = y / a else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -8.8e+74) || !(z <= 7.5e+123)) tmp = Float64(y / a); else tmp = Float64(x / Float64(t - Float64(z * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -8.8e+74) || ~((z <= 7.5e+123))) tmp = y / a; else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -8.8e+74], N[Not[LessEqual[z, 7.5e+123]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{+74} \lor \neg \left(z \leq 7.5 \cdot 10^{+123}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -8.8000000000000005e74 or 7.4999999999999999e123 < z Initial program 65.1%
*-commutative65.1%
Simplified65.1%
Taylor expanded in z around inf 63.3%
if -8.8000000000000005e74 < z < 7.4999999999999999e123Initial program 98.1%
*-commutative98.1%
Simplified98.1%
Taylor expanded in x around inf 69.1%
Final simplification67.2%
(FPCore (x y z t a) :precision binary64 (if (<= a -4.6e+17) (/ (+ y (* x (/ -1.0 z))) a) (if (<= a 1.35e-26) (/ (- x (* z y)) t) (/ (- y (/ x z)) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.6e+17) {
tmp = (y + (x * (-1.0 / z))) / a;
} else if (a <= 1.35e-26) {
tmp = (x - (z * y)) / t;
} else {
tmp = (y - (x / z)) / 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+17)) then
tmp = (y + (x * ((-1.0d0) / z))) / a
else if (a <= 1.35d-26) then
tmp = (x - (z * y)) / t
else
tmp = (y - (x / z)) / 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+17) {
tmp = (y + (x * (-1.0 / z))) / a;
} else if (a <= 1.35e-26) {
tmp = (x - (z * y)) / t;
} else {
tmp = (y - (x / z)) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -4.6e+17: tmp = (y + (x * (-1.0 / z))) / a elif a <= 1.35e-26: tmp = (x - (z * y)) / t else: tmp = (y - (x / z)) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.6e+17) tmp = Float64(Float64(y + Float64(x * Float64(-1.0 / z))) / a); elseif (a <= 1.35e-26) tmp = Float64(Float64(x - Float64(z * y)) / t); else tmp = Float64(Float64(y - Float64(x / z)) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -4.6e+17) tmp = (y + (x * (-1.0 / z))) / a; elseif (a <= 1.35e-26) tmp = (x - (z * y)) / t; else tmp = (y - (x / z)) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.6e+17], N[(N[(y + N[(x * N[(-1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[a, 1.35e-26], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.6 \cdot 10^{+17}:\\
\;\;\;\;\frac{y + x \cdot \frac{-1}{z}}{a}\\
\mathbf{elif}\;a \leq 1.35 \cdot 10^{-26}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\end{array}
\end{array}
if a < -4.6e17Initial program 79.1%
*-commutative79.1%
Simplified79.1%
Taylor expanded in x around inf 75.7%
Simplified70.8%
Taylor expanded in a around inf 77.4%
mul-1-neg77.4%
sub-neg77.4%
Simplified77.4%
div-inv77.4%
Applied egg-rr77.4%
if -4.6e17 < a < 1.34999999999999991e-26Initial program 92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in t around inf 80.9%
*-commutative80.9%
Simplified80.9%
if 1.34999999999999991e-26 < a Initial program 85.0%
*-commutative85.0%
Simplified85.0%
Taylor expanded in x around inf 80.7%
Simplified78.2%
Taylor expanded in a around inf 67.0%
mul-1-neg67.0%
sub-neg67.0%
Simplified67.0%
Final simplification76.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.55e+16) (not (<= z 1.55e+53))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.55e+16) || !(z <= 1.55e+53)) {
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 <= (-1.55d+16)) .or. (.not. (z <= 1.55d+53))) 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 <= -1.55e+16) || !(z <= 1.55e+53)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.55e+16) or not (z <= 1.55e+53): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.55e+16) || !(z <= 1.55e+53)) 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 <= -1.55e+16) || ~((z <= 1.55e+53))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.55e+16], N[Not[LessEqual[z, 1.55e+53]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+16} \lor \neg \left(z \leq 1.55 \cdot 10^{+53}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -1.55e16 or 1.5500000000000001e53 < z Initial program 71.7%
*-commutative71.7%
Simplified71.7%
Taylor expanded in z around inf 55.6%
if -1.55e16 < z < 1.5500000000000001e53Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 59.4%
Final simplification57.7%
(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 87.3%
*-commutative87.3%
Simplified87.3%
Taylor expanded in z around 0 38.0%
(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 2024147
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:alt
(! :herbie-platform default (if (< z -32113435955957344) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))) (if (< z 4392440296622287/125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* (- x (* y z)) (/ 1 (- t (* a z)))) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))))))
(/ (- x (* y z)) (- t (* a z))))