
(FPCore (x y z t) :precision binary64 (/ x (- y (* z t))))
double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / (y - (z * t))
end function
public static double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
def code(x, y, z, t): return x / (y - (z * t))
function code(x, y, z, t) return Float64(x / Float64(y - Float64(z * t))) end
function tmp = code(x, y, z, t) tmp = x / (y - (z * t)); end
code[x_, y_, z_, t_] := N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y - z \cdot t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ x (- y (* z t))))
double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / (y - (z * t))
end function
public static double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
def code(x, y, z, t): return x / (y - (z * t))
function code(x, y, z, t) return Float64(x / Float64(y - Float64(z * t))) end
function tmp = code(x, y, z, t) tmp = x / (y - (z * t)); end
code[x_, y_, z_, t_] := N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y - z \cdot t}
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= (* z t) -2e+246) (/ (/ x z) (- t)) (if (<= (* z t) 2e+251) (/ x (fma z (- t) y)) (* (/ -1.0 z) (/ x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= -2e+246) {
tmp = (x / z) / -t;
} else if ((z * t) <= 2e+251) {
tmp = x / fma(z, -t, y);
} else {
tmp = (-1.0 / z) * (x / t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * t) <= -2e+246) tmp = Float64(Float64(x / z) / Float64(-t)); elseif (Float64(z * t) <= 2e+251) tmp = Float64(x / fma(z, Float64(-t), y)); else tmp = Float64(Float64(-1.0 / z) * Float64(x / t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * t), $MachinePrecision], -2e+246], N[(N[(x / z), $MachinePrecision] / (-t)), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+251], N[(x / N[(z * (-t) + y), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 / z), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+246}:\\
\;\;\;\;\frac{\frac{x}{z}}{-t}\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+251}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(z, -t, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{z} \cdot \frac{x}{t}\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000014e246Initial program 75.4%
Taylor expanded in y around 0 75.4%
*-commutative75.4%
associate-*r/75.4%
neg-mul-175.4%
*-commutative75.4%
Simplified75.4%
neg-mul-175.4%
*-commutative75.4%
times-frac99.9%
Applied egg-rr99.9%
frac-2neg99.9%
associate-*r/99.9%
add-sqr-sqrt60.5%
sqrt-unprod74.2%
sqr-neg74.2%
sqrt-unprod26.4%
add-sqr-sqrt58.2%
associate-*l/58.2%
neg-mul-158.2%
add-sqr-sqrt31.8%
sqrt-unprod53.8%
sqr-neg53.8%
sqrt-unprod39.1%
add-sqr-sqrt99.9%
Applied egg-rr99.9%
if -2.00000000000000014e246 < (*.f64 z t) < 2.0000000000000001e251Initial program 99.8%
sub-neg99.8%
distribute-rgt-neg-out99.8%
+-commutative99.8%
fma-def99.9%
Simplified99.9%
if 2.0000000000000001e251 < (*.f64 z t) Initial program 68.4%
Taylor expanded in y around 0 68.4%
*-commutative68.4%
associate-*r/68.4%
neg-mul-168.4%
*-commutative68.4%
Simplified68.4%
neg-mul-168.4%
*-commutative68.4%
times-frac99.8%
Applied egg-rr99.8%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (<= (* z t) -2e+246) (/ (/ x z) (- t)) (if (<= (* z t) 2e+251) (/ x (- y (* z t))) (* (/ -1.0 z) (/ x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= -2e+246) {
tmp = (x / z) / -t;
} else if ((z * t) <= 2e+251) {
tmp = x / (y - (z * t));
} else {
tmp = (-1.0 / z) * (x / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z * t) <= (-2d+246)) then
tmp = (x / z) / -t
else if ((z * t) <= 2d+251) then
tmp = x / (y - (z * t))
else
tmp = ((-1.0d0) / z) * (x / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= -2e+246) {
tmp = (x / z) / -t;
} else if ((z * t) <= 2e+251) {
tmp = x / (y - (z * t));
} else {
tmp = (-1.0 / z) * (x / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * t) <= -2e+246: tmp = (x / z) / -t elif (z * t) <= 2e+251: tmp = x / (y - (z * t)) else: tmp = (-1.0 / z) * (x / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * t) <= -2e+246) tmp = Float64(Float64(x / z) / Float64(-t)); elseif (Float64(z * t) <= 2e+251) tmp = Float64(x / Float64(y - Float64(z * t))); else tmp = Float64(Float64(-1.0 / z) * Float64(x / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * t) <= -2e+246) tmp = (x / z) / -t; elseif ((z * t) <= 2e+251) tmp = x / (y - (z * t)); else tmp = (-1.0 / z) * (x / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * t), $MachinePrecision], -2e+246], N[(N[(x / z), $MachinePrecision] / (-t)), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+251], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 / z), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+246}:\\
\;\;\;\;\frac{\frac{x}{z}}{-t}\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+251}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{z} \cdot \frac{x}{t}\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000014e246Initial program 75.4%
Taylor expanded in y around 0 75.4%
*-commutative75.4%
associate-*r/75.4%
neg-mul-175.4%
*-commutative75.4%
Simplified75.4%
neg-mul-175.4%
*-commutative75.4%
times-frac99.9%
Applied egg-rr99.9%
frac-2neg99.9%
associate-*r/99.9%
add-sqr-sqrt60.5%
sqrt-unprod74.2%
sqr-neg74.2%
sqrt-unprod26.4%
add-sqr-sqrt58.2%
associate-*l/58.2%
neg-mul-158.2%
add-sqr-sqrt31.8%
sqrt-unprod53.8%
sqr-neg53.8%
sqrt-unprod39.1%
add-sqr-sqrt99.9%
Applied egg-rr99.9%
if -2.00000000000000014e246 < (*.f64 z t) < 2.0000000000000001e251Initial program 99.8%
if 2.0000000000000001e251 < (*.f64 z t) Initial program 68.4%
Taylor expanded in y around 0 68.4%
*-commutative68.4%
associate-*r/68.4%
neg-mul-168.4%
*-commutative68.4%
Simplified68.4%
neg-mul-168.4%
*-commutative68.4%
times-frac99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(if (or (<= t -9e-19)
(not (or (<= t 1.8e-6) (and (not (<= t 1750000.0)) (<= t 3.1e+97)))))
(/ (- x) (* z t))
(/ x y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9e-19) || !((t <= 1.8e-6) || (!(t <= 1750000.0) && (t <= 3.1e+97)))) {
tmp = -x / (z * t);
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-9d-19)) .or. (.not. (t <= 1.8d-6) .or. (.not. (t <= 1750000.0d0)) .and. (t <= 3.1d+97))) then
tmp = -x / (z * t)
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9e-19) || !((t <= 1.8e-6) || (!(t <= 1750000.0) && (t <= 3.1e+97)))) {
tmp = -x / (z * t);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -9e-19) or not ((t <= 1.8e-6) or (not (t <= 1750000.0) and (t <= 3.1e+97))): tmp = -x / (z * t) else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -9e-19) || !((t <= 1.8e-6) || (!(t <= 1750000.0) && (t <= 3.1e+97)))) tmp = Float64(Float64(-x) / Float64(z * t)); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -9e-19) || ~(((t <= 1.8e-6) || (~((t <= 1750000.0)) && (t <= 3.1e+97))))) tmp = -x / (z * t); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -9e-19], N[Not[Or[LessEqual[t, 1.8e-6], And[N[Not[LessEqual[t, 1750000.0]], $MachinePrecision], LessEqual[t, 3.1e+97]]]], $MachinePrecision]], N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{-19} \lor \neg \left(t \leq 1.8 \cdot 10^{-6} \lor \neg \left(t \leq 1750000\right) \land t \leq 3.1 \cdot 10^{+97}\right):\\
\;\;\;\;\frac{-x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if t < -9.00000000000000026e-19 or 1.79999999999999992e-6 < t < 1.75e6 or 3.09999999999999981e97 < t Initial program 88.0%
Taylor expanded in y around 0 72.6%
*-commutative72.6%
associate-*r/72.6%
neg-mul-172.6%
*-commutative72.6%
Simplified72.6%
if -9.00000000000000026e-19 < t < 1.79999999999999992e-6 or 1.75e6 < t < 3.09999999999999981e97Initial program 98.0%
Taylor expanded in y around inf 74.1%
Final simplification73.5%
(FPCore (x y z t)
:precision binary64
(if (or (<= t -1.4e-18)
(not (or (<= t 6.4e-6) (and (not (<= t 21500000.0)) (<= t 8.5e+83)))))
(/ (/ x z) (- t))
(/ x y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.4e-18) || !((t <= 6.4e-6) || (!(t <= 21500000.0) && (t <= 8.5e+83)))) {
tmp = (x / z) / -t;
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.4d-18)) .or. (.not. (t <= 6.4d-6) .or. (.not. (t <= 21500000.0d0)) .and. (t <= 8.5d+83))) then
tmp = (x / z) / -t
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.4e-18) || !((t <= 6.4e-6) || (!(t <= 21500000.0) && (t <= 8.5e+83)))) {
tmp = (x / z) / -t;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.4e-18) or not ((t <= 6.4e-6) or (not (t <= 21500000.0) and (t <= 8.5e+83))): tmp = (x / z) / -t else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.4e-18) || !((t <= 6.4e-6) || (!(t <= 21500000.0) && (t <= 8.5e+83)))) tmp = Float64(Float64(x / z) / Float64(-t)); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.4e-18) || ~(((t <= 6.4e-6) || (~((t <= 21500000.0)) && (t <= 8.5e+83))))) tmp = (x / z) / -t; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.4e-18], N[Not[Or[LessEqual[t, 6.4e-6], And[N[Not[LessEqual[t, 21500000.0]], $MachinePrecision], LessEqual[t, 8.5e+83]]]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] / (-t)), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{-18} \lor \neg \left(t \leq 6.4 \cdot 10^{-6} \lor \neg \left(t \leq 21500000\right) \land t \leq 8.5 \cdot 10^{+83}\right):\\
\;\;\;\;\frac{\frac{x}{z}}{-t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if t < -1.40000000000000006e-18 or 6.3999999999999997e-6 < t < 2.15e7 or 8.4999999999999995e83 < t Initial program 86.5%
Taylor expanded in y around 0 71.6%
*-commutative71.6%
associate-*r/71.6%
neg-mul-171.6%
*-commutative71.6%
Simplified71.6%
neg-mul-171.6%
*-commutative71.6%
times-frac84.8%
Applied egg-rr84.8%
frac-2neg84.8%
associate-*r/81.0%
add-sqr-sqrt42.8%
sqrt-unprod52.7%
sqr-neg52.7%
sqrt-unprod14.9%
add-sqr-sqrt33.2%
associate-*l/33.2%
neg-mul-133.2%
add-sqr-sqrt18.3%
sqrt-unprod46.4%
sqr-neg46.4%
sqrt-unprod37.9%
add-sqr-sqrt81.0%
Applied egg-rr81.0%
if -1.40000000000000006e-18 < t < 6.3999999999999997e-6 or 2.15e7 < t < 8.4999999999999995e83Initial program 99.2%
Taylor expanded in y around inf 75.6%
Final simplification77.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- (/ x t)) z)))
(if (<= t -2.5e-20)
t_1
(if (<= t 2.15e-7)
(/ x y)
(if (<= t 12000000.0)
(/ (/ x z) (- t))
(if (<= t 1.95e+84) (/ x y) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = -(x / t) / z;
double tmp;
if (t <= -2.5e-20) {
tmp = t_1;
} else if (t <= 2.15e-7) {
tmp = x / y;
} else if (t <= 12000000.0) {
tmp = (x / z) / -t;
} else if (t <= 1.95e+84) {
tmp = x / y;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = -(x / t) / z
if (t <= (-2.5d-20)) then
tmp = t_1
else if (t <= 2.15d-7) then
tmp = x / y
else if (t <= 12000000.0d0) then
tmp = (x / z) / -t
else if (t <= 1.95d+84) then
tmp = x / y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = -(x / t) / z;
double tmp;
if (t <= -2.5e-20) {
tmp = t_1;
} else if (t <= 2.15e-7) {
tmp = x / y;
} else if (t <= 12000000.0) {
tmp = (x / z) / -t;
} else if (t <= 1.95e+84) {
tmp = x / y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = -(x / t) / z tmp = 0 if t <= -2.5e-20: tmp = t_1 elif t <= 2.15e-7: tmp = x / y elif t <= 12000000.0: tmp = (x / z) / -t elif t <= 1.95e+84: tmp = x / y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-Float64(x / t)) / z) tmp = 0.0 if (t <= -2.5e-20) tmp = t_1; elseif (t <= 2.15e-7) tmp = Float64(x / y); elseif (t <= 12000000.0) tmp = Float64(Float64(x / z) / Float64(-t)); elseif (t <= 1.95e+84) tmp = Float64(x / y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -(x / t) / z; tmp = 0.0; if (t <= -2.5e-20) tmp = t_1; elseif (t <= 2.15e-7) tmp = x / y; elseif (t <= 12000000.0) tmp = (x / z) / -t; elseif (t <= 1.95e+84) tmp = x / y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-N[(x / t), $MachinePrecision]) / z), $MachinePrecision]}, If[LessEqual[t, -2.5e-20], t$95$1, If[LessEqual[t, 2.15e-7], N[(x / y), $MachinePrecision], If[LessEqual[t, 12000000.0], N[(N[(x / z), $MachinePrecision] / (-t)), $MachinePrecision], If[LessEqual[t, 1.95e+84], N[(x / y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-\frac{x}{t}}{z}\\
\mathbf{if}\;t \leq -2.5 \cdot 10^{-20}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 2.15 \cdot 10^{-7}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;t \leq 12000000:\\
\;\;\;\;\frac{\frac{x}{z}}{-t}\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{+84}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -2.4999999999999999e-20 or 1.95000000000000008e84 < t Initial program 85.7%
Taylor expanded in y around 0 70.8%
*-commutative70.8%
associate-*r/70.8%
neg-mul-170.8%
*-commutative70.8%
Simplified70.8%
Taylor expanded in x around 0 70.8%
associate-/r*84.9%
mul-1-neg84.9%
distribute-neg-frac84.9%
distribute-neg-frac84.9%
Simplified84.9%
if -2.4999999999999999e-20 < t < 2.1500000000000001e-7 or 1.2e7 < t < 1.95000000000000008e84Initial program 99.2%
Taylor expanded in y around inf 75.6%
if 2.1500000000000001e-7 < t < 1.2e7Initial program 99.7%
Taylor expanded in y around 0 84.2%
*-commutative84.2%
associate-*r/84.2%
neg-mul-184.2%
*-commutative84.2%
Simplified84.2%
neg-mul-184.2%
*-commutative84.2%
times-frac83.9%
Applied egg-rr83.9%
frac-2neg83.9%
associate-*r/84.2%
add-sqr-sqrt67.5%
sqrt-unprod51.6%
sqr-neg51.6%
sqrt-unprod0.2%
add-sqr-sqrt2.5%
associate-*l/2.5%
neg-mul-12.5%
add-sqr-sqrt2.3%
sqrt-unprod19.2%
sqr-neg19.2%
sqrt-unprod16.7%
add-sqr-sqrt84.2%
Applied egg-rr84.2%
Final simplification79.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.4e-18) (not (<= t 1.5e+110))) (/ x (* z t)) (/ x y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.4e-18) || !(t <= 1.5e+110)) {
tmp = x / (z * t);
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.4d-18)) .or. (.not. (t <= 1.5d+110))) then
tmp = x / (z * t)
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.4e-18) || !(t <= 1.5e+110)) {
tmp = x / (z * t);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.4e-18) or not (t <= 1.5e+110): tmp = x / (z * t) else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.4e-18) || !(t <= 1.5e+110)) tmp = Float64(x / Float64(z * t)); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.4e-18) || ~((t <= 1.5e+110))) tmp = x / (z * t); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.4e-18], N[Not[LessEqual[t, 1.5e+110]], $MachinePrecision]], N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{-18} \lor \neg \left(t \leq 1.5 \cdot 10^{+110}\right):\\
\;\;\;\;\frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if t < -1.40000000000000006e-18 or 1.50000000000000004e110 < t Initial program 87.7%
Taylor expanded in y around 0 72.7%
*-commutative72.7%
associate-*r/72.7%
neg-mul-172.7%
*-commutative72.7%
Simplified72.7%
expm1-log1p-u66.7%
expm1-udef43.7%
add-sqr-sqrt24.3%
sqrt-unprod39.0%
sqr-neg39.0%
sqrt-unprod17.3%
add-sqr-sqrt39.1%
associate-/r*39.1%
Applied egg-rr39.1%
expm1-def37.5%
expm1-log1p37.6%
associate-/r*36.7%
Simplified36.7%
if -1.40000000000000006e-18 < t < 1.50000000000000004e110Initial program 97.5%
Taylor expanded in y around inf 71.6%
Final simplification58.9%
(FPCore (x y z t) :precision binary64 (/ x y))
double code(double x, double y, double z, double t) {
return x / y;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / y
end function
public static double code(double x, double y, double z, double t) {
return x / y;
}
def code(x, y, z, t): return x / y
function code(x, y, z, t) return Float64(x / y) end
function tmp = code(x, y, z, t) tmp = x / y; end
code[x_, y_, z_, t_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y}
\end{array}
Initial program 94.0%
Taylor expanded in y around inf 55.9%
Final simplification55.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ 1.0 (- (/ y x) (* (/ z x) t)))))
(if (< x -1.618195973607049e+50)
t_1
(if (< x 2.1378306434876444e+131) (/ x (- y (* z t))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = 1.0 / ((y / x) - ((z / x) * t));
double tmp;
if (x < -1.618195973607049e+50) {
tmp = t_1;
} else if (x < 2.1378306434876444e+131) {
tmp = x / (y - (z * t));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 1.0d0 / ((y / x) - ((z / x) * t))
if (x < (-1.618195973607049d+50)) then
tmp = t_1
else if (x < 2.1378306434876444d+131) then
tmp = x / (y - (z * t))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 / ((y / x) - ((z / x) * t));
double tmp;
if (x < -1.618195973607049e+50) {
tmp = t_1;
} else if (x < 2.1378306434876444e+131) {
tmp = x / (y - (z * t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 1.0 / ((y / x) - ((z / x) * t)) tmp = 0 if x < -1.618195973607049e+50: tmp = t_1 elif x < 2.1378306434876444e+131: tmp = x / (y - (z * t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(1.0 / Float64(Float64(y / x) - Float64(Float64(z / x) * t))) tmp = 0.0 if (x < -1.618195973607049e+50) tmp = t_1; elseif (x < 2.1378306434876444e+131) tmp = Float64(x / Float64(y - Float64(z * t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 1.0 / ((y / x) - ((z / x) * t)); tmp = 0.0; if (x < -1.618195973607049e+50) tmp = t_1; elseif (x < 2.1378306434876444e+131) tmp = x / (y - (z * t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 / N[(N[(y / x), $MachinePrecision] - N[(N[(z / x), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[x, -1.618195973607049e+50], t$95$1, If[Less[x, 2.1378306434876444e+131], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{1}{\frac{y}{x} - \frac{z}{x} \cdot t}\\
\mathbf{if}\;x < -1.618195973607049 \cdot 10^{+50}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x < 2.1378306434876444 \cdot 10^{+131}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023301
(FPCore (x y z t)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, B"
:precision binary64
:herbie-target
(if (< x -1.618195973607049e+50) (/ 1.0 (- (/ y x) (* (/ z x) t))) (if (< x 2.1378306434876444e+131) (/ x (- y (* z t))) (/ 1.0 (- (/ y x) (* (/ z x) t)))))
(/ x (- y (* z t))))