
(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 7 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 -3.6e+96) (not (<= z 1.25e+225))) (/ y (- a (/ t z))) (/ (- x (* z y)) (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.6e+96) || !(z <= 1.25e+225)) {
tmp = y / (a - (t / z));
} 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 <= (-3.6d+96)) .or. (.not. (z <= 1.25d+225))) then
tmp = y / (a - (t / z))
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 <= -3.6e+96) || !(z <= 1.25e+225)) {
tmp = y / (a - (t / z));
} else {
tmp = (x - (z * y)) / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.6e+96) or not (z <= 1.25e+225): tmp = y / (a - (t / z)) else: tmp = (x - (z * y)) / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.6e+96) || !(z <= 1.25e+225)) tmp = Float64(y / Float64(a - Float64(t / z))); 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 <= -3.6e+96) || ~((z <= 1.25e+225))) tmp = y / (a - (t / z)); else tmp = (x - (z * y)) / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.6e+96], N[Not[LessEqual[z, 1.25e+225]], $MachinePrecision]], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $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 -3.6 \cdot 10^{+96} \lor \neg \left(z \leq 1.25 \cdot 10^{+225}\right):\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -3.60000000000000013e96 or 1.24999999999999995e225 < z Initial program 53.0%
*-commutative53.0%
Simplified53.0%
Taylor expanded in x around 0 45.3%
associate-*r/45.3%
mul-1-neg45.3%
distribute-rgt-neg-out45.3%
associate-/l*64.0%
*-commutative64.0%
Simplified64.0%
Taylor expanded in t around 0 88.8%
mul-1-neg88.8%
unsub-neg88.8%
Simplified88.8%
if -3.60000000000000013e96 < z < 1.24999999999999995e225Initial program 97.3%
Final simplification95.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ x (- t (* z a)))) (t_2 (/ y (- a (/ t z)))))
(if (<= z -6e+75)
t_2
(if (<= z 6.5e-255)
t_1
(if (<= z 8.2e-83) (/ (- x (* z y)) t) (if (<= z 3.7e-45) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x / (t - (z * a));
double t_2 = y / (a - (t / z));
double tmp;
if (z <= -6e+75) {
tmp = t_2;
} else if (z <= 6.5e-255) {
tmp = t_1;
} else if (z <= 8.2e-83) {
tmp = (x - (z * y)) / t;
} else if (z <= 3.7e-45) {
tmp = 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 = x / (t - (z * a))
t_2 = y / (a - (t / z))
if (z <= (-6d+75)) then
tmp = t_2
else if (z <= 6.5d-255) then
tmp = t_1
else if (z <= 8.2d-83) then
tmp = (x - (z * y)) / t
else if (z <= 3.7d-45) then
tmp = 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 = x / (t - (z * a));
double t_2 = y / (a - (t / z));
double tmp;
if (z <= -6e+75) {
tmp = t_2;
} else if (z <= 6.5e-255) {
tmp = t_1;
} else if (z <= 8.2e-83) {
tmp = (x - (z * y)) / t;
} else if (z <= 3.7e-45) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x / (t - (z * a)) t_2 = y / (a - (t / z)) tmp = 0 if z <= -6e+75: tmp = t_2 elif z <= 6.5e-255: tmp = t_1 elif z <= 8.2e-83: tmp = (x - (z * y)) / t elif z <= 3.7e-45: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(x / Float64(t - Float64(z * a))) t_2 = Float64(y / Float64(a - Float64(t / z))) tmp = 0.0 if (z <= -6e+75) tmp = t_2; elseif (z <= 6.5e-255) tmp = t_1; elseif (z <= 8.2e-83) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif (z <= 3.7e-45) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x / (t - (z * a)); t_2 = y / (a - (t / z)); tmp = 0.0; if (z <= -6e+75) tmp = t_2; elseif (z <= 6.5e-255) tmp = t_1; elseif (z <= 8.2e-83) tmp = (x - (z * y)) / t; elseif (z <= 3.7e-45) tmp = t_1; else tmp = t_2; 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]}, Block[{t$95$2 = N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6e+75], t$95$2, If[LessEqual[z, 6.5e-255], t$95$1, If[LessEqual[z, 8.2e-83], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 3.7e-45], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{t - z \cdot a}\\
t_2 := \frac{y}{a - \frac{t}{z}}\\
\mathbf{if}\;z \leq -6 \cdot 10^{+75}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-255}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-83}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{-45}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -6e75 or 3.7e-45 < z Initial program 70.4%
*-commutative70.4%
Simplified70.4%
Taylor expanded in x around 0 58.1%
associate-*r/58.1%
mul-1-neg58.1%
distribute-rgt-neg-out58.1%
associate-/l*69.0%
*-commutative69.0%
Simplified69.0%
Taylor expanded in t around 0 83.2%
mul-1-neg83.2%
unsub-neg83.2%
Simplified83.2%
if -6e75 < z < 6.5e-255 or 8.1999999999999999e-83 < z < 3.7e-45Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 86.7%
*-commutative86.7%
Simplified86.7%
if 6.5e-255 < z < 8.1999999999999999e-83Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around inf 92.8%
Final simplification85.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ x (- t (* z a)))))
(if (<= z -1.85e+48)
(/ (- y (/ x z)) a)
(if (<= z 2.2e-259)
t_1
(if (<= z 1.45e-83)
(/ (- x (* z y)) t)
(if (<= z 1.38e-45) t_1 (/ y (- a (/ t z)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x / (t - (z * a));
double tmp;
if (z <= -1.85e+48) {
tmp = (y - (x / z)) / a;
} else if (z <= 2.2e-259) {
tmp = t_1;
} else if (z <= 1.45e-83) {
tmp = (x - (z * y)) / t;
} else if (z <= 1.38e-45) {
tmp = t_1;
} else {
tmp = y / (a - (t / z));
}
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.85d+48)) then
tmp = (y - (x / z)) / a
else if (z <= 2.2d-259) then
tmp = t_1
else if (z <= 1.45d-83) then
tmp = (x - (z * y)) / t
else if (z <= 1.38d-45) then
tmp = t_1
else
tmp = y / (a - (t / z))
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.85e+48) {
tmp = (y - (x / z)) / a;
} else if (z <= 2.2e-259) {
tmp = t_1;
} else if (z <= 1.45e-83) {
tmp = (x - (z * y)) / t;
} else if (z <= 1.38e-45) {
tmp = t_1;
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x / (t - (z * a)) tmp = 0 if z <= -1.85e+48: tmp = (y - (x / z)) / a elif z <= 2.2e-259: tmp = t_1 elif z <= 1.45e-83: tmp = (x - (z * y)) / t elif z <= 1.38e-45: tmp = t_1 else: tmp = y / (a - (t / z)) return tmp
function code(x, y, z, t, a) t_1 = Float64(x / Float64(t - Float64(z * a))) tmp = 0.0 if (z <= -1.85e+48) tmp = Float64(Float64(y - Float64(x / z)) / a); elseif (z <= 2.2e-259) tmp = t_1; elseif (z <= 1.45e-83) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif (z <= 1.38e-45) tmp = t_1; else tmp = Float64(y / Float64(a - Float64(t / z))); 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.85e+48) tmp = (y - (x / z)) / a; elseif (z <= 2.2e-259) tmp = t_1; elseif (z <= 1.45e-83) tmp = (x - (z * y)) / t; elseif (z <= 1.38e-45) tmp = t_1; else tmp = y / (a - (t / z)); 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.85e+48], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[z, 2.2e-259], t$95$1, If[LessEqual[z, 1.45e-83], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 1.38e-45], t$95$1, N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{t - z \cdot a}\\
\mathbf{if}\;z \leq -1.85 \cdot 10^{+48}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-259}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-83}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq 1.38 \cdot 10^{-45}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\end{array}
\end{array}
if z < -1.85e48Initial program 67.7%
*-commutative67.7%
Simplified67.7%
clear-num67.5%
inv-pow67.5%
sub-neg67.5%
+-commutative67.5%
*-commutative67.5%
distribute-rgt-neg-in67.5%
fma-def67.5%
Applied egg-rr67.5%
Taylor expanded in a around 0 67.3%
+-commutative67.3%
mul-1-neg67.3%
unsub-neg67.3%
associate-/l*76.5%
Simplified76.5%
Taylor expanded in t around 0 56.3%
mul-1-neg56.3%
associate-/l/65.6%
distribute-neg-frac65.6%
div-sub65.6%
associate-/l*83.3%
*-inverses83.3%
Simplified83.3%
if -1.85e48 < z < 2.2000000000000001e-259 or 1.45e-83 < z < 1.38e-45Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 88.6%
*-commutative88.6%
Simplified88.6%
if 2.2000000000000001e-259 < z < 1.45e-83Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around inf 92.8%
if 1.38e-45 < z Initial program 75.1%
*-commutative75.1%
Simplified75.1%
Taylor expanded in x around 0 61.2%
associate-*r/61.2%
mul-1-neg61.2%
distribute-rgt-neg-out61.2%
associate-/l*68.4%
*-commutative68.4%
Simplified68.4%
Taylor expanded in t around 0 81.3%
mul-1-neg81.3%
unsub-neg81.3%
Simplified81.3%
Final simplification86.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.9e+87) (not (<= z 9.5e-10))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.9e+87) || !(z <= 9.5e-10)) {
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 <= (-1.9d+87)) .or. (.not. (z <= 9.5d-10))) 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 <= -1.9e+87) || !(z <= 9.5e-10)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.9e+87) or not (z <= 9.5e-10): tmp = y / a else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.9e+87) || !(z <= 9.5e-10)) 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 <= -1.9e+87) || ~((z <= 9.5e-10))) tmp = y / a; else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.9e+87], N[Not[LessEqual[z, 9.5e-10]], $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 -1.9 \cdot 10^{+87} \lor \neg \left(z \leq 9.5 \cdot 10^{-10}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -1.90000000000000006e87 or 9.50000000000000028e-10 < z Initial program 67.7%
*-commutative67.7%
Simplified67.7%
Taylor expanded in z around inf 65.2%
if -1.90000000000000006e87 < z < 9.50000000000000028e-10Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 79.8%
*-commutative79.8%
Simplified79.8%
Final simplification73.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6e+75) (not (<= z 7.8e-46))) (/ y (- a (/ t z))) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6e+75) || !(z <= 7.8e-46)) {
tmp = y / (a - (t / z));
} 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 <= (-6d+75)) .or. (.not. (z <= 7.8d-46))) then
tmp = y / (a - (t / z))
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 <= -6e+75) || !(z <= 7.8e-46)) {
tmp = y / (a - (t / z));
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6e+75) or not (z <= 7.8e-46): tmp = y / (a - (t / z)) else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6e+75) || !(z <= 7.8e-46)) tmp = Float64(y / Float64(a - Float64(t / z))); 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 <= -6e+75) || ~((z <= 7.8e-46))) tmp = y / (a - (t / z)); else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6e+75], N[Not[LessEqual[z, 7.8e-46]], $MachinePrecision]], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+75} \lor \neg \left(z \leq 7.8 \cdot 10^{-46}\right):\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -6e75 or 7.8000000000000005e-46 < z Initial program 70.4%
*-commutative70.4%
Simplified70.4%
Taylor expanded in x around 0 58.1%
associate-*r/58.1%
mul-1-neg58.1%
distribute-rgt-neg-out58.1%
associate-/l*69.0%
*-commutative69.0%
Simplified69.0%
Taylor expanded in t around 0 83.2%
mul-1-neg83.2%
unsub-neg83.2%
Simplified83.2%
if -6e75 < z < 7.8000000000000005e-46Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 82.5%
*-commutative82.5%
Simplified82.5%
Final simplification82.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1e+48) (not (<= z 1.9e-48))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1e+48) || !(z <= 1.9e-48)) {
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 <= (-1d+48)) .or. (.not. (z <= 1.9d-48))) 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 <= -1e+48) || !(z <= 1.9e-48)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1e+48) or not (z <= 1.9e-48): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1e+48) || !(z <= 1.9e-48)) 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 <= -1e+48) || ~((z <= 1.9e-48))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1e+48], N[Not[LessEqual[z, 1.9e-48]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+48} \lor \neg \left(z \leq 1.9 \cdot 10^{-48}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -1.00000000000000004e48 or 1.90000000000000001e-48 < z Initial program 72.5%
*-commutative72.5%
Simplified72.5%
Taylor expanded in z around inf 61.1%
if -1.00000000000000004e48 < z < 1.90000000000000001e-48Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 66.1%
Final simplification63.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 86.4%
*-commutative86.4%
Simplified86.4%
Taylor expanded in z around 0 38.4%
Final simplification38.4%
(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 2023333
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:herbie-target
(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))))