
(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 8 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) -1e+278) (/ -1.0 (* z (/ t x))) (if (<= (* z t) 2e+193) (/ x (- y (* z t))) (/ (/ (- x) z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= -1e+278) {
tmp = -1.0 / (z * (t / x));
} else if ((z * t) <= 2e+193) {
tmp = x / (y - (z * t));
} else {
tmp = (-x / z) / 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) <= (-1d+278)) then
tmp = (-1.0d0) / (z * (t / x))
else if ((z * t) <= 2d+193) then
tmp = x / (y - (z * t))
else
tmp = (-x / z) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= -1e+278) {
tmp = -1.0 / (z * (t / x));
} else if ((z * t) <= 2e+193) {
tmp = x / (y - (z * t));
} else {
tmp = (-x / z) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * t) <= -1e+278: tmp = -1.0 / (z * (t / x)) elif (z * t) <= 2e+193: tmp = x / (y - (z * t)) else: tmp = (-x / z) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * t) <= -1e+278) tmp = Float64(-1.0 / Float64(z * Float64(t / x))); elseif (Float64(z * t) <= 2e+193) tmp = Float64(x / Float64(y - Float64(z * t))); else tmp = Float64(Float64(Float64(-x) / z) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * t) <= -1e+278) tmp = -1.0 / (z * (t / x)); elseif ((z * t) <= 2e+193) tmp = x / (y - (z * t)); else tmp = (-x / z) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * t), $MachinePrecision], -1e+278], N[(-1.0 / N[(z * N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+193], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-x) / z), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+278}:\\
\;\;\;\;\frac{-1}{z \cdot \frac{t}{x}}\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+193}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-x}{z}}{t}\\
\end{array}
\end{array}
if (*.f64 z t) < -9.99999999999999964e277Initial program 72.1%
Taylor expanded in y around 0 72.1%
associate-*r/72.1%
neg-mul-172.1%
Simplified72.1%
neg-mul-172.1%
times-frac99.6%
Applied egg-rr99.6%
associate-*l/99.7%
associate-/l*99.8%
associate-/r/99.8%
Applied egg-rr99.8%
if -9.99999999999999964e277 < (*.f64 z t) < 2.00000000000000013e193Initial program 99.9%
if 2.00000000000000013e193 < (*.f64 z t) Initial program 71.5%
Taylor expanded in y around 0 71.5%
associate-*r/71.5%
neg-mul-171.5%
*-commutative71.5%
associate-/r*99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(if (or (<= y -1.15e-70)
(and (not (<= y 7.3e-183)) (or (<= y 270.0) (not (<= y 6.5e+17)))))
(/ x y)
(- (/ x (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.15e-70) || (!(y <= 7.3e-183) && ((y <= 270.0) || !(y <= 6.5e+17)))) {
tmp = x / y;
} else {
tmp = -(x / (z * 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 ((y <= (-1.15d-70)) .or. (.not. (y <= 7.3d-183)) .and. (y <= 270.0d0) .or. (.not. (y <= 6.5d+17))) then
tmp = x / y
else
tmp = -(x / (z * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.15e-70) || (!(y <= 7.3e-183) && ((y <= 270.0) || !(y <= 6.5e+17)))) {
tmp = x / y;
} else {
tmp = -(x / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.15e-70) or (not (y <= 7.3e-183) and ((y <= 270.0) or not (y <= 6.5e+17))): tmp = x / y else: tmp = -(x / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.15e-70) || (!(y <= 7.3e-183) && ((y <= 270.0) || !(y <= 6.5e+17)))) tmp = Float64(x / y); else tmp = Float64(-Float64(x / Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.15e-70) || (~((y <= 7.3e-183)) && ((y <= 270.0) || ~((y <= 6.5e+17))))) tmp = x / y; else tmp = -(x / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.15e-70], And[N[Not[LessEqual[y, 7.3e-183]], $MachinePrecision], Or[LessEqual[y, 270.0], N[Not[LessEqual[y, 6.5e+17]], $MachinePrecision]]]], N[(x / y), $MachinePrecision], (-N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{-70} \lor \neg \left(y \leq 7.3 \cdot 10^{-183}\right) \land \left(y \leq 270 \lor \neg \left(y \leq 6.5 \cdot 10^{+17}\right)\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;-\frac{x}{z \cdot t}\\
\end{array}
\end{array}
if y < -1.15e-70 or 7.29999999999999998e-183 < y < 270 or 6.5e17 < y Initial program 94.2%
Taylor expanded in y around inf 73.0%
if -1.15e-70 < y < 7.29999999999999998e-183 or 270 < y < 6.5e17Initial program 94.8%
Taylor expanded in y around 0 79.1%
associate-*r/79.1%
neg-mul-179.1%
Simplified79.1%
Final simplification75.2%
(FPCore (x y z t) :precision binary64 (if (<= z -8.8e+15) (/ (/ (- x) z) t) (if (<= z 1.42e-137) (/ x y) (* (/ -1.0 z) (/ x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -8.8e+15) {
tmp = (-x / z) / t;
} else if (z <= 1.42e-137) {
tmp = x / y;
} 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 <= (-8.8d+15)) then
tmp = (-x / z) / t
else if (z <= 1.42d-137) then
tmp = x / y
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 <= -8.8e+15) {
tmp = (-x / z) / t;
} else if (z <= 1.42e-137) {
tmp = x / y;
} else {
tmp = (-1.0 / z) * (x / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -8.8e+15: tmp = (-x / z) / t elif z <= 1.42e-137: tmp = x / y else: tmp = (-1.0 / z) * (x / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -8.8e+15) tmp = Float64(Float64(Float64(-x) / z) / t); elseif (z <= 1.42e-137) tmp = Float64(x / y); 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 <= -8.8e+15) tmp = (-x / z) / t; elseif (z <= 1.42e-137) tmp = x / y; else tmp = (-1.0 / z) * (x / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -8.8e+15], N[(N[((-x) / z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 1.42e-137], N[(x / y), $MachinePrecision], N[(N[(-1.0 / z), $MachinePrecision] * N[(x / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{+15}:\\
\;\;\;\;\frac{\frac{-x}{z}}{t}\\
\mathbf{elif}\;z \leq 1.42 \cdot 10^{-137}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{z} \cdot \frac{x}{t}\\
\end{array}
\end{array}
if z < -8.8e15Initial program 87.8%
Taylor expanded in y around 0 61.4%
associate-*r/61.4%
neg-mul-161.4%
*-commutative61.4%
associate-/r*74.6%
Simplified74.6%
if -8.8e15 < z < 1.41999999999999989e-137Initial program 99.9%
Taylor expanded in y around inf 77.3%
if 1.41999999999999989e-137 < z Initial program 93.6%
Taylor expanded in y around 0 61.3%
associate-*r/61.3%
neg-mul-161.3%
Simplified61.3%
neg-mul-161.3%
*-commutative61.3%
times-frac62.2%
Applied egg-rr62.2%
Final simplification71.3%
(FPCore (x y z t) :precision binary64 (if (<= z -2.45e+14) (/ (/ (- x) z) t) (if (<= z 9e-137) (/ x y) (/ -1.0 (* z (/ t x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.45e+14) {
tmp = (-x / z) / t;
} else if (z <= 9e-137) {
tmp = x / y;
} else {
tmp = -1.0 / (z * (t / x));
}
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 <= (-2.45d+14)) then
tmp = (-x / z) / t
else if (z <= 9d-137) then
tmp = x / y
else
tmp = (-1.0d0) / (z * (t / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.45e+14) {
tmp = (-x / z) / t;
} else if (z <= 9e-137) {
tmp = x / y;
} else {
tmp = -1.0 / (z * (t / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.45e+14: tmp = (-x / z) / t elif z <= 9e-137: tmp = x / y else: tmp = -1.0 / (z * (t / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.45e+14) tmp = Float64(Float64(Float64(-x) / z) / t); elseif (z <= 9e-137) tmp = Float64(x / y); else tmp = Float64(-1.0 / Float64(z * Float64(t / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.45e+14) tmp = (-x / z) / t; elseif (z <= 9e-137) tmp = x / y; else tmp = -1.0 / (z * (t / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.45e+14], N[(N[((-x) / z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 9e-137], N[(x / y), $MachinePrecision], N[(-1.0 / N[(z * N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.45 \cdot 10^{+14}:\\
\;\;\;\;\frac{\frac{-x}{z}}{t}\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-137}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{z \cdot \frac{t}{x}}\\
\end{array}
\end{array}
if z < -2.45e14Initial program 87.8%
Taylor expanded in y around 0 61.4%
associate-*r/61.4%
neg-mul-161.4%
*-commutative61.4%
associate-/r*74.6%
Simplified74.6%
if -2.45e14 < z < 8.9999999999999994e-137Initial program 99.9%
Taylor expanded in y around inf 77.3%
if 8.9999999999999994e-137 < z Initial program 93.6%
Taylor expanded in y around 0 61.3%
associate-*r/61.3%
neg-mul-161.3%
Simplified61.3%
neg-mul-161.3%
times-frac64.2%
Applied egg-rr64.2%
associate-*l/64.3%
associate-/l*63.0%
associate-/r/62.0%
Applied egg-rr62.0%
Final simplification71.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.75e+15) (not (<= z 9e-137))) (/ (/ (- x) t) z) (/ x y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.75e+15) || !(z <= 9e-137)) {
tmp = (-x / t) / z;
} 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 ((z <= (-1.75d+15)) .or. (.not. (z <= 9d-137))) then
tmp = (-x / t) / z
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 ((z <= -1.75e+15) || !(z <= 9e-137)) {
tmp = (-x / t) / z;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.75e+15) or not (z <= 9e-137): tmp = (-x / t) / z else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.75e+15) || !(z <= 9e-137)) tmp = Float64(Float64(Float64(-x) / t) / z); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.75e+15) || ~((z <= 9e-137))) tmp = (-x / t) / z; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.75e+15], N[Not[LessEqual[z, 9e-137]], $MachinePrecision]], N[(N[((-x) / t), $MachinePrecision] / z), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{+15} \lor \neg \left(z \leq 9 \cdot 10^{-137}\right):\\
\;\;\;\;\frac{\frac{-x}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if z < -1.75e15 or 8.9999999999999994e-137 < z Initial program 91.0%
Taylor expanded in y around 0 61.3%
associate-*r/61.3%
neg-mul-161.3%
Simplified61.3%
neg-mul-161.3%
times-frac68.7%
Applied egg-rr68.7%
associate-*r/65.3%
associate-*l/65.4%
neg-mul-165.4%
Applied egg-rr65.4%
if -1.75e15 < z < 8.9999999999999994e-137Initial program 99.9%
Taylor expanded in y around inf 77.3%
Final simplification69.9%
(FPCore (x y z t) :precision binary64 (if (<= z -1460000000000.0) (/ (/ (- x) z) t) (if (<= z 9e-137) (/ x y) (/ (/ (- x) t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1460000000000.0) {
tmp = (-x / z) / t;
} else if (z <= 9e-137) {
tmp = x / y;
} else {
tmp = (-x / t) / z;
}
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 <= (-1460000000000.0d0)) then
tmp = (-x / z) / t
else if (z <= 9d-137) then
tmp = x / y
else
tmp = (-x / t) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1460000000000.0) {
tmp = (-x / z) / t;
} else if (z <= 9e-137) {
tmp = x / y;
} else {
tmp = (-x / t) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1460000000000.0: tmp = (-x / z) / t elif z <= 9e-137: tmp = x / y else: tmp = (-x / t) / z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1460000000000.0) tmp = Float64(Float64(Float64(-x) / z) / t); elseif (z <= 9e-137) tmp = Float64(x / y); else tmp = Float64(Float64(Float64(-x) / t) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1460000000000.0) tmp = (-x / z) / t; elseif (z <= 9e-137) tmp = x / y; else tmp = (-x / t) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1460000000000.0], N[(N[((-x) / z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 9e-137], N[(x / y), $MachinePrecision], N[(N[((-x) / t), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1460000000000:\\
\;\;\;\;\frac{\frac{-x}{z}}{t}\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-137}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-x}{t}}{z}\\
\end{array}
\end{array}
if z < -1.46e12Initial program 87.8%
Taylor expanded in y around 0 61.4%
associate-*r/61.4%
neg-mul-161.4%
*-commutative61.4%
associate-/r*74.6%
Simplified74.6%
if -1.46e12 < z < 8.9999999999999994e-137Initial program 99.9%
Taylor expanded in y around inf 77.3%
if 8.9999999999999994e-137 < z Initial program 93.6%
Taylor expanded in y around 0 61.3%
associate-*r/61.3%
neg-mul-161.3%
Simplified61.3%
neg-mul-161.3%
times-frac64.2%
Applied egg-rr64.2%
associate-*r/62.2%
associate-*l/62.3%
neg-mul-162.3%
Applied egg-rr62.3%
Final simplification71.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.6e-19) (not (<= t 6.8e+203))) (/ x (* z t)) (/ x y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.6e-19) || !(t <= 6.8e+203)) {
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.6d-19)) .or. (.not. (t <= 6.8d+203))) 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.6e-19) || !(t <= 6.8e+203)) {
tmp = x / (z * t);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.6e-19) or not (t <= 6.8e+203): tmp = x / (z * t) else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.6e-19) || !(t <= 6.8e+203)) 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.6e-19) || ~((t <= 6.8e+203))) tmp = x / (z * t); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.6e-19], N[Not[LessEqual[t, 6.8e+203]], $MachinePrecision]], N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{-19} \lor \neg \left(t \leq 6.8 \cdot 10^{+203}\right):\\
\;\;\;\;\frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if t < -1.59999999999999991e-19 or 6.8000000000000002e203 < t Initial program 84.3%
Taylor expanded in y around 0 66.2%
associate-*r/66.2%
neg-mul-166.2%
Simplified66.2%
associate-/l/76.5%
expm1-log1p-u71.8%
expm1-udef36.2%
associate-/r*39.9%
add-sqr-sqrt24.1%
sqrt-unprod34.1%
sqr-neg34.1%
sqrt-unprod15.8%
add-sqr-sqrt35.0%
Applied egg-rr35.0%
expm1-def32.5%
expm1-log1p32.7%
*-commutative32.7%
Simplified32.7%
if -1.59999999999999991e-19 < t < 6.8000000000000002e203Initial program 99.9%
Taylor expanded in y around inf 66.5%
Final simplification54.6%
(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.4%
Taylor expanded in y around inf 53.3%
Final simplification53.3%
(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 2024013
(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))))