
(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) (- INFINITY)) (/ (/ x (- t)) z) (if (<= (* z t) 5e+260) (/ x (- y (* z t))) (* (/ -1.0 z) (/ x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= -((double) INFINITY)) {
tmp = (x / -t) / z;
} else if ((z * t) <= 5e+260) {
tmp = x / (y - (z * t));
} else {
tmp = (-1.0 / z) * (x / t);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= -Double.POSITIVE_INFINITY) {
tmp = (x / -t) / z;
} else if ((z * t) <= 5e+260) {
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) <= -math.inf: tmp = (x / -t) / z elif (z * t) <= 5e+260: 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) <= Float64(-Inf)) tmp = Float64(Float64(x / Float64(-t)) / z); elseif (Float64(z * t) <= 5e+260) 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) <= -Inf) tmp = (x / -t) / z; elseif ((z * t) <= 5e+260) 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], (-Infinity)], N[(N[(x / (-t)), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+260], 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 -\infty:\\
\;\;\;\;\frac{\frac{x}{-t}}{z}\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+260}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{z} \cdot \frac{x}{t}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 58.8%
Taylor expanded in y around 0 58.8%
associate-*r/58.8%
neg-mul-158.8%
Simplified58.8%
neg-mul-158.8%
*-commutative58.8%
times-frac100.0%
Applied egg-rr100.0%
associate-*l/100.0%
associate-*r/100.0%
associate-*l/99.7%
frac-2neg99.7%
metadata-eval99.7%
associate-*l/100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
if -inf.0 < (*.f64 z t) < 4.9999999999999996e260Initial program 99.9%
if 4.9999999999999996e260 < (*.f64 z t) Initial program 77.9%
Taylor expanded in y around 0 77.9%
associate-*r/77.9%
neg-mul-177.9%
Simplified77.9%
neg-mul-177.9%
*-commutative77.9%
times-frac100.0%
Applied egg-rr100.0%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(if (<= y -3.4e+37)
(/ x y)
(if (<= y 1.4e-274)
(/ (/ x (- t)) z)
(if (<= y 1.35e-128)
(/ (/ (- x) z) t)
(if (<= y 1.35e-67) (/ (- x) (* z t)) (/ x y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.4e+37) {
tmp = x / y;
} else if (y <= 1.4e-274) {
tmp = (x / -t) / z;
} else if (y <= 1.35e-128) {
tmp = (-x / z) / t;
} else if (y <= 1.35e-67) {
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 (y <= (-3.4d+37)) then
tmp = x / y
else if (y <= 1.4d-274) then
tmp = (x / -t) / z
else if (y <= 1.35d-128) then
tmp = (-x / z) / t
else if (y <= 1.35d-67) 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 (y <= -3.4e+37) {
tmp = x / y;
} else if (y <= 1.4e-274) {
tmp = (x / -t) / z;
} else if (y <= 1.35e-128) {
tmp = (-x / z) / t;
} else if (y <= 1.35e-67) {
tmp = -x / (z * t);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.4e+37: tmp = x / y elif y <= 1.4e-274: tmp = (x / -t) / z elif y <= 1.35e-128: tmp = (-x / z) / t elif y <= 1.35e-67: tmp = -x / (z * t) else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.4e+37) tmp = Float64(x / y); elseif (y <= 1.4e-274) tmp = Float64(Float64(x / Float64(-t)) / z); elseif (y <= 1.35e-128) tmp = Float64(Float64(Float64(-x) / z) / t); elseif (y <= 1.35e-67) 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 (y <= -3.4e+37) tmp = x / y; elseif (y <= 1.4e-274) tmp = (x / -t) / z; elseif (y <= 1.35e-128) tmp = (-x / z) / t; elseif (y <= 1.35e-67) tmp = -x / (z * t); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.4e+37], N[(x / y), $MachinePrecision], If[LessEqual[y, 1.4e-274], N[(N[(x / (-t)), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 1.35e-128], N[(N[((-x) / z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[y, 1.35e-67], N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+37}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-274}:\\
\;\;\;\;\frac{\frac{x}{-t}}{z}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{-128}:\\
\;\;\;\;\frac{\frac{-x}{z}}{t}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{-67}:\\
\;\;\;\;\frac{-x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if y < -3.40000000000000006e37 or 1.35000000000000008e-67 < y Initial program 99.3%
Taylor expanded in y around inf 75.6%
if -3.40000000000000006e37 < y < 1.39999999999999988e-274Initial program 87.8%
Taylor expanded in y around 0 67.3%
associate-*r/67.3%
neg-mul-167.3%
Simplified67.3%
neg-mul-167.3%
*-commutative67.3%
times-frac75.7%
Applied egg-rr75.7%
associate-*l/75.9%
associate-*r/75.9%
associate-*l/75.7%
frac-2neg75.7%
metadata-eval75.7%
associate-*l/75.9%
*-un-lft-identity75.9%
Applied egg-rr75.9%
if 1.39999999999999988e-274 < y < 1.35000000000000003e-128Initial program 96.1%
Taylor expanded in y around 0 86.5%
associate-*r/86.5%
neg-mul-186.5%
*-commutative86.5%
associate-/r*83.0%
Simplified83.0%
if 1.35000000000000003e-128 < y < 1.35000000000000008e-67Initial program 100.0%
Taylor expanded in y around 0 100.0%
associate-*r/100.0%
neg-mul-1100.0%
Simplified100.0%
Final simplification77.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.4e-20) (not (<= y 4.1e+26))) (/ x y) (/ (- x) (* z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.4e-20) || !(y <= 4.1e+26)) {
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 <= (-2.4d-20)) .or. (.not. (y <= 4.1d+26))) 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 <= -2.4e-20) || !(y <= 4.1e+26)) {
tmp = x / y;
} else {
tmp = -x / (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.4e-20) or not (y <= 4.1e+26): tmp = x / y else: tmp = -x / (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.4e-20) || !(y <= 4.1e+26)) 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 <= -2.4e-20) || ~((y <= 4.1e+26))) tmp = x / y; else tmp = -x / (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.4e-20], N[Not[LessEqual[y, 4.1e+26]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{-20} \lor \neg \left(y \leq 4.1 \cdot 10^{+26}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{z \cdot t}\\
\end{array}
\end{array}
if y < -2.39999999999999993e-20 or 4.09999999999999983e26 < y Initial program 96.5%
Taylor expanded in y around inf 77.6%
if -2.39999999999999993e-20 < y < 4.09999999999999983e26Initial program 94.9%
Taylor expanded in y around 0 74.5%
associate-*r/74.5%
neg-mul-174.5%
Simplified74.5%
Final simplification76.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.1e+37) (not (<= y 1e-67))) (/ x y) (/ (/ x (- t)) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.1e+37) || !(y <= 1e-67)) {
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 ((y <= (-3.1d+37)) .or. (.not. (y <= 1d-67))) 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 ((y <= -3.1e+37) || !(y <= 1e-67)) {
tmp = x / y;
} else {
tmp = (x / -t) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.1e+37) or not (y <= 1e-67): tmp = x / y else: tmp = (x / -t) / z return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.1e+37) || !(y <= 1e-67)) tmp = Float64(x / y); else tmp = Float64(Float64(x / Float64(-t)) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.1e+37) || ~((y <= 1e-67))) tmp = x / y; else tmp = (x / -t) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.1e+37], N[Not[LessEqual[y, 1e-67]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(N[(x / (-t)), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{+37} \lor \neg \left(y \leq 10^{-67}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{-t}}{z}\\
\end{array}
\end{array}
if y < -3.1000000000000002e37 or 9.99999999999999943e-68 < y Initial program 99.3%
Taylor expanded in y around inf 75.6%
if -3.1000000000000002e37 < y < 9.99999999999999943e-68Initial program 90.9%
Taylor expanded in y around 0 75.1%
associate-*r/75.1%
neg-mul-175.1%
Simplified75.1%
neg-mul-175.1%
*-commutative75.1%
times-frac78.1%
Applied egg-rr78.1%
associate-*l/78.2%
associate-*r/78.2%
associate-*l/78.1%
frac-2neg78.1%
metadata-eval78.1%
associate-*l/78.2%
*-un-lft-identity78.2%
Applied egg-rr78.2%
Final simplification76.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.9e-48) (not (<= t 1.35e+217))) (/ x (* z t)) (/ x y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.9e-48) || !(t <= 1.35e+217)) {
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 <= (-2.9d-48)) .or. (.not. (t <= 1.35d+217))) 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 <= -2.9e-48) || !(t <= 1.35e+217)) {
tmp = x / (z * t);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.9e-48) or not (t <= 1.35e+217): tmp = x / (z * t) else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.9e-48) || !(t <= 1.35e+217)) 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 <= -2.9e-48) || ~((t <= 1.35e+217))) tmp = x / (z * t); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.9e-48], N[Not[LessEqual[t, 1.35e+217]], $MachinePrecision]], N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{-48} \lor \neg \left(t \leq 1.35 \cdot 10^{+217}\right):\\
\;\;\;\;\frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if t < -2.9000000000000003e-48 or 1.35000000000000001e217 < t Initial program 92.8%
Taylor expanded in y around 0 66.4%
associate-*r/66.4%
neg-mul-166.4%
Simplified66.4%
associate-/l/69.2%
expm1-log1p-u66.2%
expm1-udef42.9%
associate-/r*44.7%
add-sqr-sqrt18.3%
sqrt-unprod39.0%
sqr-neg39.0%
sqrt-unprod21.9%
add-sqr-sqrt39.4%
Applied egg-rr39.4%
expm1-def35.9%
expm1-log1p36.2%
associate-/r*36.0%
Simplified36.0%
Taylor expanded in x around 0 36.2%
if -2.9000000000000003e-48 < t < 1.35000000000000001e217Initial program 97.6%
Taylor expanded in y around inf 61.2%
Final simplification51.2%
(FPCore (x y z t) :precision binary64 (if (<= t -2.9e-48) (/ x (* z t)) (if (<= t 2.7e+216) (/ x y) (/ (/ x t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.9e-48) {
tmp = x / (z * t);
} else if (t <= 2.7e+216) {
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 (t <= (-2.9d-48)) then
tmp = x / (z * t)
else if (t <= 2.7d+216) 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 (t <= -2.9e-48) {
tmp = x / (z * t);
} else if (t <= 2.7e+216) {
tmp = x / y;
} else {
tmp = (x / t) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.9e-48: tmp = x / (z * t) elif t <= 2.7e+216: tmp = x / y else: tmp = (x / t) / z return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.9e-48) tmp = Float64(x / Float64(z * t)); elseif (t <= 2.7e+216) tmp = Float64(x / y); else tmp = Float64(Float64(x / t) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.9e-48) tmp = x / (z * t); elseif (t <= 2.7e+216) tmp = x / y; else tmp = (x / t) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.9e-48], N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.7e+216], N[(x / y), $MachinePrecision], N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{-48}:\\
\;\;\;\;\frac{x}{z \cdot t}\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{+216}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t}}{z}\\
\end{array}
\end{array}
if t < -2.9000000000000003e-48Initial program 94.2%
Taylor expanded in y around 0 64.5%
associate-*r/64.5%
neg-mul-164.5%
Simplified64.5%
associate-/l/67.1%
expm1-log1p-u63.4%
expm1-udef40.8%
associate-/r*42.0%
add-sqr-sqrt17.8%
sqrt-unprod37.3%
sqr-neg37.3%
sqrt-unprod19.5%
add-sqr-sqrt36.5%
Applied egg-rr36.5%
expm1-def32.1%
expm1-log1p32.4%
associate-/r*32.3%
Simplified32.3%
Taylor expanded in x around 0 32.4%
if -2.9000000000000003e-48 < t < 2.7000000000000001e216Initial program 97.6%
Taylor expanded in y around inf 61.2%
if 2.7000000000000001e216 < t Initial program 87.5%
Taylor expanded in y around 0 74.0%
associate-*r/74.0%
neg-mul-174.0%
Simplified74.0%
neg-mul-174.0%
*-commutative74.0%
times-frac86.3%
Applied egg-rr86.3%
associate-*l/86.4%
associate-*r/86.4%
associate-*l/86.2%
frac-2neg86.2%
metadata-eval86.2%
associate-*l/86.4%
*-un-lft-identity86.4%
Applied egg-rr86.4%
associate-/l/74.0%
associate-/r*77.1%
add-sqr-sqrt0.0%
sqrt-unprod50.6%
sqr-neg50.6%
sqrt-unprod50.4%
add-sqr-sqrt50.4%
associate-/r*50.7%
*-commutative50.7%
expm1-log1p-u50.6%
expm1-udef50.7%
Applied egg-rr50.7%
expm1-def50.6%
expm1-log1p50.7%
associate-/r*50.5%
Simplified50.5%
Final simplification51.2%
(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 95.7%
Taylor expanded in y around inf 51.3%
Final simplification51.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 2024031
(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))))