
(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 10 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 (- (/ y (- a (/ t z))) (/ x (- (* a z) t))))
double code(double x, double y, double z, double t, double a) {
return (y / (a - (t / z))) - (x / ((a * z) - 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 = (y / (a - (t / z))) - (x / ((a * z) - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (y / (a - (t / z))) - (x / ((a * z) - t));
}
def code(x, y, z, t, a): return (y / (a - (t / z))) - (x / ((a * z) - t))
function code(x, y, z, t, a) return Float64(Float64(y / Float64(a - Float64(t / z))) - Float64(x / Float64(Float64(a * z) - t))) end
function tmp = code(x, y, z, t, a) tmp = (y / (a - (t / z))) - (x / ((a * z) - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(a * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{a - \frac{t}{z}} - \frac{x}{a \cdot z - t}
\end{array}
Initial program 83.7%
sub-neg83.7%
+-commutative83.7%
neg-sub083.7%
associate-+l-83.7%
sub0-neg83.7%
neg-mul-183.7%
sub-neg83.7%
+-commutative83.7%
neg-sub083.7%
associate-+l-83.7%
sub0-neg83.7%
neg-mul-183.7%
times-frac83.7%
metadata-eval83.7%
*-lft-identity83.7%
*-commutative83.7%
Simplified83.7%
div-sub83.4%
associate-/l*85.4%
Applied egg-rr85.4%
Taylor expanded in z around 0 94.2%
neg-mul-194.2%
unsub-neg94.2%
Simplified94.2%
Final simplification94.2%
(FPCore (x y z t a)
:precision binary64
(if (or (<= z -7.2e-60)
(and (not (<= z 1.42e-154))
(or (<= z 6.5e-125) (not (<= z 1.85e-44)))))
(/ y (- a (/ t z)))
(/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.2e-60) || (!(z <= 1.42e-154) && ((z <= 6.5e-125) || !(z <= 1.85e-44)))) {
tmp = y / (a - (t / z));
} 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 <= (-7.2d-60)) .or. (.not. (z <= 1.42d-154)) .and. (z <= 6.5d-125) .or. (.not. (z <= 1.85d-44))) then
tmp = y / (a - (t / z))
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 <= -7.2e-60) || (!(z <= 1.42e-154) && ((z <= 6.5e-125) || !(z <= 1.85e-44)))) {
tmp = y / (a - (t / z));
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.2e-60) or (not (z <= 1.42e-154) and ((z <= 6.5e-125) or not (z <= 1.85e-44))): tmp = y / (a - (t / z)) else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.2e-60) || (!(z <= 1.42e-154) && ((z <= 6.5e-125) || !(z <= 1.85e-44)))) tmp = Float64(y / Float64(a - Float64(t / z))); else tmp = Float64(x / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -7.2e-60) || (~((z <= 1.42e-154)) && ((z <= 6.5e-125) || ~((z <= 1.85e-44))))) tmp = y / (a - (t / z)); else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.2e-60], And[N[Not[LessEqual[z, 1.42e-154]], $MachinePrecision], Or[LessEqual[z, 6.5e-125], N[Not[LessEqual[z, 1.85e-44]], $MachinePrecision]]]], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{-60} \lor \neg \left(z \leq 1.42 \cdot 10^{-154}\right) \land \left(z \leq 6.5 \cdot 10^{-125} \lor \neg \left(z \leq 1.85 \cdot 10^{-44}\right)\right):\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -7.2e-60 or 1.42e-154 < z < 6.4999999999999999e-125 or 1.85e-44 < z Initial program 74.4%
sub-neg74.4%
+-commutative74.4%
neg-sub074.4%
associate-+l-74.4%
sub0-neg74.4%
neg-mul-174.4%
sub-neg74.4%
+-commutative74.4%
neg-sub074.4%
associate-+l-74.4%
sub0-neg74.4%
neg-mul-174.4%
times-frac74.4%
metadata-eval74.4%
*-lft-identity74.4%
*-commutative74.4%
Simplified74.4%
div-sub73.8%
associate-/l*80.0%
Applied egg-rr80.0%
Taylor expanded in z around 0 93.9%
neg-mul-193.9%
unsub-neg93.9%
Simplified93.9%
Taylor expanded in y around inf 73.7%
if -7.2e-60 < z < 1.42e-154 or 6.4999999999999999e-125 < z < 1.85e-44Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
times-frac99.8%
metadata-eval99.8%
*-lft-identity99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 70.4%
Final simplification72.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.75e+47) (not (<= a 2e-21))) (+ (/ y a) (/ -1.0 (* z (/ a x)))) (/ (- x (* y z)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.75e+47) || !(a <= 2e-21)) {
tmp = (y / a) + (-1.0 / (z * (a / x)));
} else {
tmp = (x - (y * z)) / 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 <= (-1.75d+47)) .or. (.not. (a <= 2d-21))) then
tmp = (y / a) + ((-1.0d0) / (z * (a / x)))
else
tmp = (x - (y * z)) / 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 <= -1.75e+47) || !(a <= 2e-21)) {
tmp = (y / a) + (-1.0 / (z * (a / x)));
} else {
tmp = (x - (y * z)) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.75e+47) or not (a <= 2e-21): tmp = (y / a) + (-1.0 / (z * (a / x))) else: tmp = (x - (y * z)) / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.75e+47) || !(a <= 2e-21)) tmp = Float64(Float64(y / a) + Float64(-1.0 / Float64(z * Float64(a / x)))); else tmp = Float64(Float64(x - Float64(y * z)) / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.75e+47) || ~((a <= 2e-21))) tmp = (y / a) + (-1.0 / (z * (a / x))); else tmp = (x - (y * z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.75e+47], N[Not[LessEqual[a, 2e-21]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] + N[(-1.0 / N[(z * N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.75 \cdot 10^{+47} \lor \neg \left(a \leq 2 \cdot 10^{-21}\right):\\
\;\;\;\;\frac{y}{a} + \frac{-1}{z \cdot \frac{a}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\end{array}
\end{array}
if a < -1.75000000000000008e47 or 1.99999999999999982e-21 < a Initial program 73.7%
sub-neg73.7%
+-commutative73.7%
neg-sub073.7%
associate-+l-73.7%
sub0-neg73.7%
neg-mul-173.7%
sub-neg73.7%
+-commutative73.7%
neg-sub073.7%
associate-+l-73.7%
sub0-neg73.7%
neg-mul-173.7%
times-frac73.7%
metadata-eval73.7%
*-lft-identity73.7%
*-commutative73.7%
Simplified73.7%
div-sub73.7%
associate-/l*74.8%
Applied egg-rr74.8%
Taylor expanded in t around 0 74.9%
*-commutative74.9%
Simplified74.9%
clear-num74.8%
inv-pow74.8%
*-commutative74.8%
Applied egg-rr74.8%
unpow-174.8%
*-commutative74.8%
Simplified74.8%
Taylor expanded in z around 0 74.8%
*-commutative74.8%
associate-*r/78.8%
Simplified78.8%
if -1.75000000000000008e47 < a < 1.99999999999999982e-21Initial program 93.9%
sub-neg93.9%
+-commutative93.9%
neg-sub093.9%
associate-+l-93.9%
sub0-neg93.9%
neg-mul-193.9%
sub-neg93.9%
+-commutative93.9%
neg-sub093.9%
associate-+l-93.9%
sub0-neg93.9%
neg-mul-193.9%
times-frac93.9%
metadata-eval93.9%
*-lft-identity93.9%
*-commutative93.9%
Simplified93.9%
Taylor expanded in a around 0 80.2%
associate-*r/80.2%
neg-mul-180.2%
neg-sub080.2%
sub-neg80.2%
+-commutative80.2%
associate--r+80.2%
neg-sub080.2%
remove-double-neg80.2%
*-commutative80.2%
Simplified80.2%
Final simplification79.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -7.2e+159) (/ y (- a (/ t z))) (if (<= z 3.8e+121) (/ (- x (* y z)) (- t (* a z))) (/ (- y (/ x z)) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.2e+159) {
tmp = y / (a - (t / z));
} else if (z <= 3.8e+121) {
tmp = (x - (y * z)) / (t - (a * z));
} 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 <= (-7.2d+159)) then
tmp = y / (a - (t / z))
else if (z <= 3.8d+121) then
tmp = (x - (y * z)) / (t - (a * z))
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 <= -7.2e+159) {
tmp = y / (a - (t / z));
} else if (z <= 3.8e+121) {
tmp = (x - (y * z)) / (t - (a * z));
} else {
tmp = (y - (x / z)) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7.2e+159: tmp = y / (a - (t / z)) elif z <= 3.8e+121: tmp = (x - (y * z)) / (t - (a * z)) else: tmp = (y - (x / z)) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7.2e+159) tmp = Float64(y / Float64(a - Float64(t / z))); elseif (z <= 3.8e+121) tmp = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))); 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 <= -7.2e+159) tmp = y / (a - (t / z)); elseif (z <= 3.8e+121) tmp = (x - (y * z)) / (t - (a * z)); else tmp = (y - (x / z)) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7.2e+159], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.8e+121], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+159}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+121}:\\
\;\;\;\;\frac{x - y \cdot z}{t - a \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\end{array}
\end{array}
if z < -7.20000000000000073e159Initial program 43.7%
sub-neg43.7%
+-commutative43.7%
neg-sub043.7%
associate-+l-43.7%
sub0-neg43.7%
neg-mul-143.7%
sub-neg43.7%
+-commutative43.7%
neg-sub043.7%
associate-+l-43.7%
sub0-neg43.7%
neg-mul-143.7%
times-frac43.7%
metadata-eval43.7%
*-lft-identity43.7%
*-commutative43.7%
Simplified43.7%
div-sub43.8%
associate-/l*59.5%
Applied egg-rr59.5%
Taylor expanded in z around 0 97.0%
neg-mul-197.0%
unsub-neg97.0%
Simplified97.0%
Taylor expanded in y around inf 90.1%
if -7.20000000000000073e159 < z < 3.8e121Initial program 95.8%
if 3.8e121 < z Initial program 52.7%
sub-neg52.7%
+-commutative52.7%
neg-sub052.7%
associate-+l-52.7%
sub0-neg52.7%
neg-mul-152.7%
sub-neg52.7%
+-commutative52.7%
neg-sub052.7%
associate-+l-52.7%
sub0-neg52.7%
neg-mul-152.7%
times-frac52.7%
metadata-eval52.7%
*-lft-identity52.7%
*-commutative52.7%
Simplified52.7%
div-sub52.7%
associate-/l*70.3%
Applied egg-rr70.3%
Taylor expanded in a around inf 85.3%
Final simplification93.7%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.1e+49) (/ (- y (/ x z)) a) (if (<= a 6.3e-21) (/ (- x (* y z)) t) (- (/ y a) (/ x (* a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.1e+49) {
tmp = (y - (x / z)) / a;
} else if (a <= 6.3e-21) {
tmp = (x - (y * z)) / t;
} else {
tmp = (y / a) - (x / (a * 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) :: tmp
if (a <= (-1.1d+49)) then
tmp = (y - (x / z)) / a
else if (a <= 6.3d-21) then
tmp = (x - (y * z)) / t
else
tmp = (y / a) - (x / (a * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.1e+49) {
tmp = (y - (x / z)) / a;
} else if (a <= 6.3e-21) {
tmp = (x - (y * z)) / t;
} else {
tmp = (y / a) - (x / (a * z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.1e+49: tmp = (y - (x / z)) / a elif a <= 6.3e-21: tmp = (x - (y * z)) / t else: tmp = (y / a) - (x / (a * z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.1e+49) tmp = Float64(Float64(y - Float64(x / z)) / a); elseif (a <= 6.3e-21) tmp = Float64(Float64(x - Float64(y * z)) / t); else tmp = Float64(Float64(y / a) - Float64(x / Float64(a * z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.1e+49) tmp = (y - (x / z)) / a; elseif (a <= 6.3e-21) tmp = (x - (y * z)) / t; else tmp = (y / a) - (x / (a * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.1e+49], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[a, 6.3e-21], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(N[(y / a), $MachinePrecision] - N[(x / N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.1 \cdot 10^{+49}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{elif}\;a \leq 6.3 \cdot 10^{-21}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} - \frac{x}{a \cdot z}\\
\end{array}
\end{array}
if a < -1.1e49Initial program 73.4%
sub-neg73.4%
+-commutative73.4%
neg-sub073.4%
associate-+l-73.4%
sub0-neg73.4%
neg-mul-173.4%
sub-neg73.4%
+-commutative73.4%
neg-sub073.4%
associate-+l-73.4%
sub0-neg73.4%
neg-mul-173.4%
times-frac73.4%
metadata-eval73.4%
*-lft-identity73.4%
*-commutative73.4%
Simplified73.4%
div-sub73.4%
associate-/l*75.5%
Applied egg-rr75.5%
Taylor expanded in a around inf 82.8%
if -1.1e49 < a < 6.3e-21Initial program 93.9%
sub-neg93.9%
+-commutative93.9%
neg-sub093.9%
associate-+l-93.9%
sub0-neg93.9%
neg-mul-193.9%
sub-neg93.9%
+-commutative93.9%
neg-sub093.9%
associate-+l-93.9%
sub0-neg93.9%
neg-mul-193.9%
times-frac93.9%
metadata-eval93.9%
*-lft-identity93.9%
*-commutative93.9%
Simplified93.9%
Taylor expanded in a around 0 80.2%
associate-*r/80.2%
neg-mul-180.2%
neg-sub080.2%
sub-neg80.2%
+-commutative80.2%
associate--r+80.2%
neg-sub080.2%
remove-double-neg80.2%
*-commutative80.2%
Simplified80.2%
if 6.3e-21 < a Initial program 73.9%
sub-neg73.9%
+-commutative73.9%
neg-sub073.9%
associate-+l-73.9%
sub0-neg73.9%
neg-mul-173.9%
sub-neg73.9%
+-commutative73.9%
neg-sub073.9%
associate-+l-73.9%
sub0-neg73.9%
neg-mul-173.9%
times-frac73.9%
metadata-eval73.9%
*-lft-identity73.9%
*-commutative73.9%
Simplified73.9%
div-sub73.9%
associate-/l*74.3%
Applied egg-rr74.3%
Taylor expanded in t around 0 72.4%
*-commutative72.4%
Simplified72.4%
Final simplification78.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.175e+33)
(/ y a)
(if (<= z -2.15e-17)
(* y (- (/ z t)))
(if (<= z -3.4e-50) (/ y a) (if (<= z 1.22e-17) (/ x t) (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.175e+33) {
tmp = y / a;
} else if (z <= -2.15e-17) {
tmp = y * -(z / t);
} else if (z <= -3.4e-50) {
tmp = y / a;
} else if (z <= 1.22e-17) {
tmp = x / 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.175d+33)) then
tmp = y / a
else if (z <= (-2.15d-17)) then
tmp = y * -(z / t)
else if (z <= (-3.4d-50)) then
tmp = y / a
else if (z <= 1.22d-17) then
tmp = x / 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.175e+33) {
tmp = y / a;
} else if (z <= -2.15e-17) {
tmp = y * -(z / t);
} else if (z <= -3.4e-50) {
tmp = y / a;
} else if (z <= 1.22e-17) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.175e+33: tmp = y / a elif z <= -2.15e-17: tmp = y * -(z / t) elif z <= -3.4e-50: tmp = y / a elif z <= 1.22e-17: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.175e+33) tmp = Float64(y / a); elseif (z <= -2.15e-17) tmp = Float64(y * Float64(-Float64(z / t))); elseif (z <= -3.4e-50) tmp = Float64(y / a); elseif (z <= 1.22e-17) tmp = Float64(x / 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.175e+33) tmp = y / a; elseif (z <= -2.15e-17) tmp = y * -(z / t); elseif (z <= -3.4e-50) tmp = y / a; elseif (z <= 1.22e-17) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.175e+33], N[(y / a), $MachinePrecision], If[LessEqual[z, -2.15e-17], N[(y * (-N[(z / t), $MachinePrecision])), $MachinePrecision], If[LessEqual[z, -3.4e-50], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.22e-17], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.175 \cdot 10^{+33}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -2.15 \cdot 10^{-17}:\\
\;\;\;\;y \cdot \left(-\frac{z}{t}\right)\\
\mathbf{elif}\;z \leq -3.4 \cdot 10^{-50}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.22 \cdot 10^{-17}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.17499999999999995e33 or -2.15000000000000012e-17 < z < -3.40000000000000014e-50 or 1.22e-17 < z Initial program 67.9%
sub-neg67.9%
+-commutative67.9%
neg-sub067.9%
associate-+l-67.9%
sub0-neg67.9%
neg-mul-167.9%
sub-neg67.9%
+-commutative67.9%
neg-sub067.9%
associate-+l-67.9%
sub0-neg67.9%
neg-mul-167.9%
times-frac67.9%
metadata-eval67.9%
*-lft-identity67.9%
*-commutative67.9%
Simplified67.9%
Taylor expanded in z around inf 60.6%
if -1.17499999999999995e33 < z < -2.15000000000000012e-17Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
times-frac99.9%
metadata-eval99.9%
*-lft-identity99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around inf 68.3%
*-commutative68.3%
associate-*r/68.4%
*-commutative68.4%
Simplified68.4%
Taylor expanded in z around 0 52.4%
associate-*r/52.4%
neg-mul-152.4%
Simplified52.4%
if -3.40000000000000014e-50 < z < 1.22e-17Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
times-frac99.8%
metadata-eval99.8%
*-lft-identity99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 63.1%
Final simplification61.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9e-51) (not (<= z 1.1e-39))) (/ y (- a (/ t z))) (/ (- x (* y z)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9e-51) || !(z <= 1.1e-39)) {
tmp = y / (a - (t / z));
} else {
tmp = (x - (y * z)) / 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 <= (-9d-51)) .or. (.not. (z <= 1.1d-39))) then
tmp = y / (a - (t / z))
else
tmp = (x - (y * z)) / 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 <= -9e-51) || !(z <= 1.1e-39)) {
tmp = y / (a - (t / z));
} else {
tmp = (x - (y * z)) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9e-51) or not (z <= 1.1e-39): tmp = y / (a - (t / z)) else: tmp = (x - (y * z)) / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9e-51) || !(z <= 1.1e-39)) tmp = Float64(y / Float64(a - Float64(t / z))); else tmp = Float64(Float64(x - Float64(y * z)) / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -9e-51) || ~((z <= 1.1e-39))) tmp = y / (a - (t / z)); else tmp = (x - (y * z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9e-51], N[Not[LessEqual[z, 1.1e-39]], $MachinePrecision]], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-51} \lor \neg \left(z \leq 1.1 \cdot 10^{-39}\right):\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\end{array}
\end{array}
if z < -8.99999999999999948e-51 or 1.1e-39 < z Initial program 72.6%
sub-neg72.6%
+-commutative72.6%
neg-sub072.6%
associate-+l-72.6%
sub0-neg72.6%
neg-mul-172.6%
sub-neg72.6%
+-commutative72.6%
neg-sub072.6%
associate-+l-72.6%
sub0-neg72.6%
neg-mul-172.6%
times-frac72.6%
metadata-eval72.6%
*-lft-identity72.6%
*-commutative72.6%
Simplified72.6%
div-sub71.9%
associate-/l*79.8%
Applied egg-rr79.8%
Taylor expanded in z around 0 94.7%
neg-mul-194.7%
unsub-neg94.7%
Simplified94.7%
Taylor expanded in y around inf 74.3%
if -8.99999999999999948e-51 < z < 1.1e-39Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
times-frac99.8%
metadata-eval99.8%
*-lft-identity99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in a around 0 78.7%
associate-*r/78.7%
neg-mul-178.7%
neg-sub078.7%
sub-neg78.7%
+-commutative78.7%
associate--r+78.7%
neg-sub078.7%
remove-double-neg78.7%
*-commutative78.7%
Simplified78.7%
Final simplification76.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -3.7e+47) (not (<= a 5.5e-23))) (/ (- y (/ x z)) a) (/ (- x (* y z)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3.7e+47) || !(a <= 5.5e-23)) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (y * z)) / 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 <= (-3.7d+47)) .or. (.not. (a <= 5.5d-23))) then
tmp = (y - (x / z)) / a
else
tmp = (x - (y * z)) / 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 <= -3.7e+47) || !(a <= 5.5e-23)) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (y * z)) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -3.7e+47) or not (a <= 5.5e-23): tmp = (y - (x / z)) / a else: tmp = (x - (y * z)) / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -3.7e+47) || !(a <= 5.5e-23)) tmp = Float64(Float64(y - Float64(x / z)) / a); else tmp = Float64(Float64(x - Float64(y * z)) / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -3.7e+47) || ~((a <= 5.5e-23))) tmp = (y - (x / z)) / a; else tmp = (x - (y * z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -3.7e+47], N[Not[LessEqual[a, 5.5e-23]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.7 \cdot 10^{+47} \lor \neg \left(a \leq 5.5 \cdot 10^{-23}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\end{array}
\end{array}
if a < -3.70000000000000041e47 or 5.5000000000000001e-23 < a Initial program 73.7%
sub-neg73.7%
+-commutative73.7%
neg-sub073.7%
associate-+l-73.7%
sub0-neg73.7%
neg-mul-173.7%
sub-neg73.7%
+-commutative73.7%
neg-sub073.7%
associate-+l-73.7%
sub0-neg73.7%
neg-mul-173.7%
times-frac73.7%
metadata-eval73.7%
*-lft-identity73.7%
*-commutative73.7%
Simplified73.7%
div-sub73.7%
associate-/l*74.8%
Applied egg-rr74.8%
Taylor expanded in a around inf 75.8%
if -3.70000000000000041e47 < a < 5.5000000000000001e-23Initial program 93.9%
sub-neg93.9%
+-commutative93.9%
neg-sub093.9%
associate-+l-93.9%
sub0-neg93.9%
neg-mul-193.9%
sub-neg93.9%
+-commutative93.9%
neg-sub093.9%
associate-+l-93.9%
sub0-neg93.9%
neg-mul-193.9%
times-frac93.9%
metadata-eval93.9%
*-lft-identity93.9%
*-commutative93.9%
Simplified93.9%
Taylor expanded in a around 0 80.2%
associate-*r/80.2%
neg-mul-180.2%
neg-sub080.2%
sub-neg80.2%
+-commutative80.2%
associate--r+80.2%
neg-sub080.2%
remove-double-neg80.2%
*-commutative80.2%
Simplified80.2%
Final simplification78.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.2e-52) (/ y a) (if (<= z 2.25e-18) (/ x t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.2e-52) {
tmp = y / a;
} else if (z <= 2.25e-18) {
tmp = x / 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 <= (-3.2d-52)) then
tmp = y / a
else if (z <= 2.25d-18) then
tmp = x / 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 <= -3.2e-52) {
tmp = y / a;
} else if (z <= 2.25e-18) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.2e-52: tmp = y / a elif z <= 2.25e-18: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.2e-52) tmp = Float64(y / a); elseif (z <= 2.25e-18) tmp = Float64(x / t); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.2e-52) tmp = y / a; elseif (z <= 2.25e-18) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.2e-52], N[(y / a), $MachinePrecision], If[LessEqual[z, 2.25e-18], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{-52}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{-18}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -3.2000000000000001e-52 or 2.24999999999999997e-18 < z Initial program 71.2%
sub-neg71.2%
+-commutative71.2%
neg-sub071.2%
associate-+l-71.2%
sub0-neg71.2%
neg-mul-171.2%
sub-neg71.2%
+-commutative71.2%
neg-sub071.2%
associate-+l-71.2%
sub0-neg71.2%
neg-mul-171.2%
times-frac71.2%
metadata-eval71.2%
*-lft-identity71.2%
*-commutative71.2%
Simplified71.2%
Taylor expanded in z around inf 56.1%
if -3.2000000000000001e-52 < z < 2.24999999999999997e-18Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
times-frac99.8%
metadata-eval99.8%
*-lft-identity99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 63.1%
Final simplification59.1%
(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.7%
sub-neg83.7%
+-commutative83.7%
neg-sub083.7%
associate-+l-83.7%
sub0-neg83.7%
neg-mul-183.7%
sub-neg83.7%
+-commutative83.7%
neg-sub083.7%
associate-+l-83.7%
sub0-neg83.7%
neg-mul-183.7%
times-frac83.7%
metadata-eval83.7%
*-lft-identity83.7%
*-commutative83.7%
Simplified83.7%
Taylor expanded in z around 0 37.7%
Final simplification37.7%
(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 2023257
(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))))