
(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 (<= z -5e+140) (/ y (- a (/ t z))) (if (<= z 7e+133) (/ (- x (* z y)) (- t (* z a))) (/ (- y (/ x z)) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5e+140) {
tmp = y / (a - (t / z));
} else if (z <= 7e+133) {
tmp = (x - (z * y)) / (t - (z * a));
} 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 (z <= (-5d+140)) then
tmp = y / (a - (t / z))
else if (z <= 7d+133) then
tmp = (x - (z * y)) / (t - (z * a))
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 (z <= -5e+140) {
tmp = y / (a - (t / z));
} else if (z <= 7e+133) {
tmp = (x - (z * y)) / (t - (z * a));
} else {
tmp = (y - (x / z)) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5e+140: tmp = y / (a - (t / z)) elif z <= 7e+133: tmp = (x - (z * y)) / (t - (z * a)) else: tmp = (y - (x / z)) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5e+140) tmp = Float64(y / Float64(a - Float64(t / z))); elseif (z <= 7e+133) tmp = Float64(Float64(x - Float64(z * y)) / Float64(t - Float64(z * a))); 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 (z <= -5e+140) tmp = y / (a - (t / z)); elseif (z <= 7e+133) tmp = (x - (z * y)) / (t - (z * a)); else tmp = (y - (x / z)) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5e+140], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7e+133], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+140}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+133}:\\
\;\;\;\;\frac{x - z \cdot y}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\end{array}
\end{array}
if z < -5.00000000000000008e140Initial program 45.5%
*-commutative45.5%
Simplified45.5%
Taylor expanded in z around inf 45.5%
Taylor expanded in x around 0 89.4%
associate-*r/89.4%
neg-mul-189.4%
Simplified89.4%
if -5.00000000000000008e140 < z < 6.9999999999999997e133Initial program 95.5%
if 6.9999999999999997e133 < z Initial program 62.1%
*-commutative62.1%
Simplified62.1%
Taylor expanded in y around inf 70.8%
Simplified70.8%
Taylor expanded in y around 0 62.1%
*-commutative62.1%
associate-*r/73.9%
*-commutative73.9%
fma-neg73.8%
Simplified73.8%
Taylor expanded in a around inf 91.4%
mul-1-neg91.4%
unsub-neg91.4%
Simplified91.4%
Final simplification94.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- x (* z y)) t)) (t_2 (/ (- y (/ x z)) a)))
(if (<= z -2.6e+91)
t_2
(if (<= z -3.6e+78)
t_1
(if (<= z -1.15e-68)
t_2
(if (<= z 5e-265)
t_1
(if (<= z 1.2e-26)
(/ x (- t (* z a)))
(if (<= z 3.6e+130) t_1 t_2))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (z * y)) / t;
double t_2 = (y - (x / z)) / a;
double tmp;
if (z <= -2.6e+91) {
tmp = t_2;
} else if (z <= -3.6e+78) {
tmp = t_1;
} else if (z <= -1.15e-68) {
tmp = t_2;
} else if (z <= 5e-265) {
tmp = t_1;
} else if (z <= 1.2e-26) {
tmp = x / (t - (z * a));
} else if (z <= 3.6e+130) {
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 - (z * y)) / t
t_2 = (y - (x / z)) / a
if (z <= (-2.6d+91)) then
tmp = t_2
else if (z <= (-3.6d+78)) then
tmp = t_1
else if (z <= (-1.15d-68)) then
tmp = t_2
else if (z <= 5d-265) then
tmp = t_1
else if (z <= 1.2d-26) then
tmp = x / (t - (z * a))
else if (z <= 3.6d+130) 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 - (z * y)) / t;
double t_2 = (y - (x / z)) / a;
double tmp;
if (z <= -2.6e+91) {
tmp = t_2;
} else if (z <= -3.6e+78) {
tmp = t_1;
} else if (z <= -1.15e-68) {
tmp = t_2;
} else if (z <= 5e-265) {
tmp = t_1;
} else if (z <= 1.2e-26) {
tmp = x / (t - (z * a));
} else if (z <= 3.6e+130) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x - (z * y)) / t t_2 = (y - (x / z)) / a tmp = 0 if z <= -2.6e+91: tmp = t_2 elif z <= -3.6e+78: tmp = t_1 elif z <= -1.15e-68: tmp = t_2 elif z <= 5e-265: tmp = t_1 elif z <= 1.2e-26: tmp = x / (t - (z * a)) elif z <= 3.6e+130: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x - Float64(z * y)) / t) t_2 = Float64(Float64(y - Float64(x / z)) / a) tmp = 0.0 if (z <= -2.6e+91) tmp = t_2; elseif (z <= -3.6e+78) tmp = t_1; elseif (z <= -1.15e-68) tmp = t_2; elseif (z <= 5e-265) tmp = t_1; elseif (z <= 1.2e-26) tmp = Float64(x / Float64(t - Float64(z * a))); elseif (z <= 3.6e+130) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x - (z * y)) / t; t_2 = (y - (x / z)) / a; tmp = 0.0; if (z <= -2.6e+91) tmp = t_2; elseif (z <= -3.6e+78) tmp = t_1; elseif (z <= -1.15e-68) tmp = t_2; elseif (z <= 5e-265) tmp = t_1; elseif (z <= 1.2e-26) tmp = x / (t - (z * a)); elseif (z <= 3.6e+130) tmp = t_1; else tmp = t_2; 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]}, Block[{t$95$2 = N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[z, -2.6e+91], t$95$2, If[LessEqual[z, -3.6e+78], t$95$1, If[LessEqual[z, -1.15e-68], t$95$2, If[LessEqual[z, 5e-265], t$95$1, If[LessEqual[z, 1.2e-26], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.6e+130], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - z \cdot y}{t}\\
t_2 := \frac{y - \frac{x}{z}}{a}\\
\mathbf{if}\;z \leq -2.6 \cdot 10^{+91}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{+78}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.15 \cdot 10^{-68}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-265}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-26}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+130}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -2.6e91 or -3.6000000000000002e78 < z < -1.14999999999999998e-68 or 3.6000000000000001e130 < z Initial program 64.8%
*-commutative64.8%
Simplified64.8%
Taylor expanded in y around inf 69.5%
Simplified69.5%
Taylor expanded in y around 0 64.8%
*-commutative64.8%
associate-*r/75.9%
*-commutative75.9%
fma-neg75.9%
Simplified75.9%
Taylor expanded in a around inf 80.0%
mul-1-neg80.0%
unsub-neg80.0%
Simplified80.0%
if -2.6e91 < z < -3.6000000000000002e78 or -1.14999999999999998e-68 < z < 5.0000000000000001e-265 or 1.2e-26 < z < 3.6000000000000001e130Initial program 95.1%
*-commutative95.1%
Simplified95.1%
Taylor expanded in t around inf 82.4%
if 5.0000000000000001e-265 < z < 1.2e-26Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 81.0%
*-commutative81.0%
Simplified81.0%
Final simplification81.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ y (- a (/ t z)))))
(if (<= z -4.2e-69)
t_1
(if (<= z 1.6e-264)
(/ (- x (* z y)) t)
(if (<= z 1.25e-15)
(/ x (- t (* z a)))
(if (<= z 3.6e+119) t_1 (/ (- y (/ x z)) a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y / (a - (t / z));
double tmp;
if (z <= -4.2e-69) {
tmp = t_1;
} else if (z <= 1.6e-264) {
tmp = (x - (z * y)) / t;
} else if (z <= 1.25e-15) {
tmp = x / (t - (z * a));
} else if (z <= 3.6e+119) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = y / (a - (t / z))
if (z <= (-4.2d-69)) then
tmp = t_1
else if (z <= 1.6d-264) then
tmp = (x - (z * y)) / t
else if (z <= 1.25d-15) then
tmp = x / (t - (z * a))
else if (z <= 3.6d+119) then
tmp = t_1
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 t_1 = y / (a - (t / z));
double tmp;
if (z <= -4.2e-69) {
tmp = t_1;
} else if (z <= 1.6e-264) {
tmp = (x - (z * y)) / t;
} else if (z <= 1.25e-15) {
tmp = x / (t - (z * a));
} else if (z <= 3.6e+119) {
tmp = t_1;
} else {
tmp = (y - (x / z)) / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y / (a - (t / z)) tmp = 0 if z <= -4.2e-69: tmp = t_1 elif z <= 1.6e-264: tmp = (x - (z * y)) / t elif z <= 1.25e-15: tmp = x / (t - (z * a)) elif z <= 3.6e+119: tmp = t_1 else: tmp = (y - (x / z)) / a return tmp
function code(x, y, z, t, a) t_1 = Float64(y / Float64(a - Float64(t / z))) tmp = 0.0 if (z <= -4.2e-69) tmp = t_1; elseif (z <= 1.6e-264) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif (z <= 1.25e-15) tmp = Float64(x / Float64(t - Float64(z * a))); elseif (z <= 3.6e+119) tmp = t_1; else tmp = Float64(Float64(y - Float64(x / z)) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y / (a - (t / z)); tmp = 0.0; if (z <= -4.2e-69) tmp = t_1; elseif (z <= 1.6e-264) tmp = (x - (z * y)) / t; elseif (z <= 1.25e-15) tmp = x / (t - (z * a)); elseif (z <= 3.6e+119) tmp = t_1; else tmp = (y - (x / z)) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.2e-69], t$95$1, If[LessEqual[z, 1.6e-264], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 1.25e-15], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.6e+119], t$95$1, N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a - \frac{t}{z}}\\
\mathbf{if}\;z \leq -4.2 \cdot 10^{-69}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-264}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{-15}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+119}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\end{array}
\end{array}
if z < -4.1999999999999999e-69 or 1.25e-15 < z < 3.60000000000000001e119Initial program 72.6%
*-commutative72.6%
Simplified72.6%
Taylor expanded in z around inf 72.6%
Taylor expanded in x around 0 74.0%
associate-*r/74.0%
neg-mul-174.0%
Simplified74.0%
if -4.1999999999999999e-69 < z < 1.59999999999999998e-264Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around inf 92.1%
if 1.59999999999999998e-264 < z < 1.25e-15Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 81.7%
*-commutative81.7%
Simplified81.7%
if 3.60000000000000001e119 < z Initial program 65.1%
*-commutative65.1%
Simplified65.1%
Taylor expanded in y around inf 73.1%
Simplified73.1%
Taylor expanded in y around 0 65.1%
*-commutative65.1%
associate-*r/75.9%
*-commutative75.9%
fma-neg75.9%
Simplified75.9%
Taylor expanded in a around inf 87.0%
mul-1-neg87.0%
unsub-neg87.0%
Simplified87.0%
Final simplification81.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- x (* z y)) t)))
(if (<= z -6.2e+92)
(/ y a)
(if (<= z 3.8e-265)
t_1
(if (<= z 2.3e-23)
(/ x (- t (* z a)))
(if (<= z 1.6e+132) 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 <= -6.2e+92) {
tmp = y / a;
} else if (z <= 3.8e-265) {
tmp = t_1;
} else if (z <= 2.3e-23) {
tmp = x / (t - (z * a));
} else if (z <= 1.6e+132) {
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 <= (-6.2d+92)) then
tmp = y / a
else if (z <= 3.8d-265) then
tmp = t_1
else if (z <= 2.3d-23) then
tmp = x / (t - (z * a))
else if (z <= 1.6d+132) 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 <= -6.2e+92) {
tmp = y / a;
} else if (z <= 3.8e-265) {
tmp = t_1;
} else if (z <= 2.3e-23) {
tmp = x / (t - (z * a));
} else if (z <= 1.6e+132) {
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 <= -6.2e+92: tmp = y / a elif z <= 3.8e-265: tmp = t_1 elif z <= 2.3e-23: tmp = x / (t - (z * a)) elif z <= 1.6e+132: 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 <= -6.2e+92) tmp = Float64(y / a); elseif (z <= 3.8e-265) tmp = t_1; elseif (z <= 2.3e-23) tmp = Float64(x / Float64(t - Float64(z * a))); elseif (z <= 1.6e+132) 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 <= -6.2e+92) tmp = y / a; elseif (z <= 3.8e-265) tmp = t_1; elseif (z <= 2.3e-23) tmp = x / (t - (z * a)); elseif (z <= 1.6e+132) 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, -6.2e+92], N[(y / a), $MachinePrecision], If[LessEqual[z, 3.8e-265], t$95$1, If[LessEqual[z, 2.3e-23], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.6e+132], 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 -6.2 \cdot 10^{+92}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-265}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-23}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+132}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -6.2000000000000004e92 or 1.5999999999999999e132 < z Initial program 57.4%
*-commutative57.4%
Simplified57.4%
Taylor expanded in z around inf 67.7%
if -6.2000000000000004e92 < z < 3.7999999999999998e-265 or 2.3000000000000001e-23 < z < 1.5999999999999999e132Initial program 94.4%
*-commutative94.4%
Simplified94.4%
Taylor expanded in t around inf 74.1%
if 3.7999999999999998e-265 < z < 2.3000000000000001e-23Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 81.0%
*-commutative81.0%
Simplified81.0%
Final simplification73.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.5e+93)
(/ y a)
(if (<= z 1.9e+73)
(/ x (- t (* z a)))
(if (<= z 5.5e+105) (* y (/ z (- t))) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.5e+93) {
tmp = y / a;
} else if (z <= 1.9e+73) {
tmp = x / (t - (z * a));
} else if (z <= 5.5e+105) {
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 <= (-2.5d+93)) then
tmp = y / a
else if (z <= 1.9d+73) then
tmp = x / (t - (z * a))
else if (z <= 5.5d+105) 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 <= -2.5e+93) {
tmp = y / a;
} else if (z <= 1.9e+73) {
tmp = x / (t - (z * a));
} else if (z <= 5.5e+105) {
tmp = y * (z / -t);
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.5e+93: tmp = y / a elif z <= 1.9e+73: tmp = x / (t - (z * a)) elif z <= 5.5e+105: tmp = y * (z / -t) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.5e+93) tmp = Float64(y / a); elseif (z <= 1.9e+73) tmp = Float64(x / Float64(t - Float64(z * a))); elseif (z <= 5.5e+105) 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 <= -2.5e+93) tmp = y / a; elseif (z <= 1.9e+73) tmp = x / (t - (z * a)); elseif (z <= 5.5e+105) tmp = y * (z / -t); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.5e+93], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.9e+73], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.5e+105], N[(y * N[(z / (-t)), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+93}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{+73}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{+105}:\\
\;\;\;\;y \cdot \frac{z}{-t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -2.5000000000000001e93 or 5.49999999999999979e105 < z Initial program 59.1%
*-commutative59.1%
Simplified59.1%
Taylor expanded in z around inf 64.8%
if -2.5000000000000001e93 < z < 1.90000000000000011e73Initial program 97.4%
*-commutative97.4%
Simplified97.4%
Taylor expanded in x around inf 69.9%
*-commutative69.9%
Simplified69.9%
if 1.90000000000000011e73 < z < 5.49999999999999979e105Initial program 76.2%
*-commutative76.2%
Simplified76.2%
clear-num76.0%
associate-/r/75.8%
sub-neg75.8%
+-commutative75.8%
*-commutative75.8%
distribute-rgt-neg-in75.8%
fma-define75.8%
Applied egg-rr75.8%
Taylor expanded in a around 0 75.0%
Taylor expanded in x around 0 75.1%
mul-1-neg75.1%
distribute-rgt-neg-out75.1%
Simplified75.1%
Taylor expanded in t around 0 75.5%
mul-1-neg75.5%
associate-*r/87.1%
distribute-rgt-neg-in87.1%
distribute-neg-frac287.1%
Simplified87.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.15e-68) (/ y a) (if (<= z 3.6e-17) (/ x t) (if (<= z 5.3e+104) (* y (/ z (- t))) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.15e-68) {
tmp = y / a;
} else if (z <= 3.6e-17) {
tmp = x / t;
} else if (z <= 5.3e+104) {
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.15d-68)) then
tmp = y / a
else if (z <= 3.6d-17) then
tmp = x / t
else if (z <= 5.3d+104) 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.15e-68) {
tmp = y / a;
} else if (z <= 3.6e-17) {
tmp = x / t;
} else if (z <= 5.3e+104) {
tmp = y * (z / -t);
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.15e-68: tmp = y / a elif z <= 3.6e-17: tmp = x / t elif z <= 5.3e+104: tmp = y * (z / -t) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.15e-68) tmp = Float64(y / a); elseif (z <= 3.6e-17) tmp = Float64(x / t); elseif (z <= 5.3e+104) 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.15e-68) tmp = y / a; elseif (z <= 3.6e-17) tmp = x / t; elseif (z <= 5.3e+104) tmp = y * (z / -t); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.15e-68], N[(y / a), $MachinePrecision], If[LessEqual[z, 3.6e-17], N[(x / t), $MachinePrecision], If[LessEqual[z, 5.3e+104], N[(y * N[(z / (-t)), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{-68}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-17}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 5.3 \cdot 10^{+104}:\\
\;\;\;\;y \cdot \frac{z}{-t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.14999999999999998e-68 or 5.2999999999999999e104 < z Initial program 67.3%
*-commutative67.3%
Simplified67.3%
Taylor expanded in z around inf 56.8%
if -1.14999999999999998e-68 < z < 3.59999999999999995e-17Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 62.7%
if 3.59999999999999995e-17 < z < 5.2999999999999999e104Initial program 85.7%
*-commutative85.7%
Simplified85.7%
clear-num84.4%
associate-/r/85.4%
sub-neg85.4%
+-commutative85.4%
*-commutative85.4%
distribute-rgt-neg-in85.4%
fma-define85.4%
Applied egg-rr85.4%
Taylor expanded in a around 0 63.2%
Taylor expanded in x around 0 52.5%
mul-1-neg52.5%
distribute-rgt-neg-out52.5%
Simplified52.5%
Taylor expanded in t around 0 52.8%
mul-1-neg52.8%
associate-*r/56.1%
distribute-rgt-neg-in56.1%
distribute-neg-frac256.1%
Simplified56.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.15e-68) (not (<= z 1.06e-7))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.15e-68) || !(z <= 1.06e-7)) {
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.15d-68)) .or. (.not. (z <= 1.06d-7))) 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.15e-68) || !(z <= 1.06e-7)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.15e-68) or not (z <= 1.06e-7): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.15e-68) || !(z <= 1.06e-7)) 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.15e-68) || ~((z <= 1.06e-7))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.15e-68], N[Not[LessEqual[z, 1.06e-7]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{-68} \lor \neg \left(z \leq 1.06 \cdot 10^{-7}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -1.14999999999999998e-68 or 1.06e-7 < z Initial program 70.1%
*-commutative70.1%
Simplified70.1%
Taylor expanded in z around inf 52.1%
if -1.14999999999999998e-68 < z < 1.06e-7Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 62.0%
Final simplification56.6%
(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 83.6%
*-commutative83.6%
Simplified83.6%
Taylor expanded in z around 0 36.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 2024102
(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))))