
(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 9 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}
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= (* z t) (- INFINITY)) (/ (/ (- x) t) z) (if (<= (* z t) 2e+243) (/ x (- y (* z t))) (/ -1.0 (* t (/ z x))))))
assert(z < 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) <= 2e+243) {
tmp = x / (y - (z * t));
} else {
tmp = -1.0 / (t * (z / x));
}
return tmp;
}
assert z < t;
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) <= 2e+243) {
tmp = x / (y - (z * t));
} else {
tmp = -1.0 / (t * (z / x));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (z * t) <= -math.inf: tmp = (-x / t) / z elif (z * t) <= 2e+243: tmp = x / (y - (z * t)) else: tmp = -1.0 / (t * (z / x)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(z * t) <= Float64(-Inf)) tmp = Float64(Float64(Float64(-x) / t) / z); elseif (Float64(z * t) <= 2e+243) tmp = Float64(x / Float64(y - Float64(z * t))); else tmp = Float64(-1.0 / Float64(t * Float64(z / x))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((z * t) <= -Inf)
tmp = (-x / t) / z;
elseif ((z * t) <= 2e+243)
tmp = x / (y - (z * t));
else
tmp = -1.0 / (t * (z / x));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. 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], 2e+243], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 / N[(t * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;\frac{\frac{-x}{t}}{z}\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+243}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{t \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 78.9%
Taylor expanded in y around 0 78.9%
associate-*r/78.9%
neg-mul-178.9%
Simplified78.9%
neg-mul-178.9%
*-commutative78.9%
times-frac99.8%
Applied egg-rr99.8%
associate-*l/99.9%
associate-*r/99.9%
neg-mul-199.9%
Applied egg-rr99.9%
if -inf.0 < (*.f64 z t) < 2.0000000000000001e243Initial program 99.9%
if 2.0000000000000001e243 < (*.f64 z t) Initial program 71.9%
Taylor expanded in y around 0 71.9%
associate-*r/71.9%
neg-mul-171.9%
Simplified71.9%
neg-mul-171.9%
*-commutative71.9%
times-frac99.7%
Applied egg-rr99.7%
*-commutative99.7%
clear-num99.5%
frac-times99.8%
metadata-eval99.8%
associate-/r/99.7%
div-inv99.7%
clear-num99.7%
Applied egg-rr99.7%
Final simplification99.9%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= y -4.5e-25) (not (<= y 1e-97))) (/ x y) (/ (- x) (* z t))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.5e-25) || !(y <= 1e-97)) {
tmp = x / y;
} else {
tmp = -x / (z * t);
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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 <= (-4.5d-25)) .or. (.not. (y <= 1d-97))) then
tmp = x / y
else
tmp = -x / (z * t)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.5e-25) || !(y <= 1e-97)) {
tmp = x / y;
} else {
tmp = -x / (z * t);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (y <= -4.5e-25) or not (y <= 1e-97): tmp = x / y else: tmp = -x / (z * t) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -4.5e-25) || !(y <= 1e-97)) tmp = Float64(x / y); else tmp = Float64(Float64(-x) / Float64(z * t)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((y <= -4.5e-25) || ~((y <= 1e-97)))
tmp = x / y;
else
tmp = -x / (z * t);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.5e-25], N[Not[LessEqual[y, 1e-97]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{-25} \lor \neg \left(y \leq 10^{-97}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{z \cdot t}\\
\end{array}
\end{array}
if y < -4.5000000000000001e-25 or 1.00000000000000004e-97 < y Initial program 95.8%
Taylor expanded in y around inf 78.0%
if -4.5000000000000001e-25 < y < 1.00000000000000004e-97Initial program 94.8%
Taylor expanded in y around 0 72.9%
associate-*r/72.9%
neg-mul-172.9%
Simplified72.9%
Final simplification76.1%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= z -4.1e+46) (not (<= z 1.4e-57))) (/ (/ (- x) t) z) (/ x y)))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.1e+46) || !(z <= 1.4e-57)) {
tmp = (-x / t) / z;
} else {
tmp = x / y;
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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 <= (-4.1d+46)) .or. (.not. (z <= 1.4d-57))) then
tmp = (-x / t) / z
else
tmp = x / y
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.1e+46) || !(z <= 1.4e-57)) {
tmp = (-x / t) / z;
} else {
tmp = x / y;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (z <= -4.1e+46) or not (z <= 1.4e-57): tmp = (-x / t) / z else: tmp = x / y return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((z <= -4.1e+46) || !(z <= 1.4e-57)) tmp = Float64(Float64(Float64(-x) / t) / z); else tmp = Float64(x / y); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((z <= -4.1e+46) || ~((z <= 1.4e-57)))
tmp = (-x / t) / z;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.1e+46], N[Not[LessEqual[z, 1.4e-57]], $MachinePrecision]], N[(N[((-x) / t), $MachinePrecision] / z), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{+46} \lor \neg \left(z \leq 1.4 \cdot 10^{-57}\right):\\
\;\;\;\;\frac{\frac{-x}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if z < -4.1e46 or 1.4e-57 < z Initial program 90.6%
Taylor expanded in y around 0 62.3%
associate-*r/62.3%
neg-mul-162.3%
Simplified62.3%
neg-mul-162.3%
*-commutative62.3%
times-frac70.8%
Applied egg-rr70.8%
associate-*l/70.8%
associate-*r/70.8%
neg-mul-170.8%
Applied egg-rr70.8%
if -4.1e46 < z < 1.4e-57Initial program 99.9%
Taylor expanded in y around inf 74.9%
Final simplification73.0%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= z -1.55e+46) (not (<= z 1.4e-57))) (/ (/ (- x) z) t) (/ x y)))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.55e+46) || !(z <= 1.4e-57)) {
tmp = (-x / z) / t;
} else {
tmp = x / y;
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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.55d+46)) .or. (.not. (z <= 1.4d-57))) then
tmp = (-x / z) / t
else
tmp = x / y
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.55e+46) || !(z <= 1.4e-57)) {
tmp = (-x / z) / t;
} else {
tmp = x / y;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (z <= -1.55e+46) or not (z <= 1.4e-57): tmp = (-x / z) / t else: tmp = x / y return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((z <= -1.55e+46) || !(z <= 1.4e-57)) tmp = Float64(Float64(Float64(-x) / z) / t); else tmp = Float64(x / y); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((z <= -1.55e+46) || ~((z <= 1.4e-57)))
tmp = (-x / z) / t;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.55e+46], N[Not[LessEqual[z, 1.4e-57]], $MachinePrecision]], N[(N[((-x) / z), $MachinePrecision] / t), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+46} \lor \neg \left(z \leq 1.4 \cdot 10^{-57}\right):\\
\;\;\;\;\frac{\frac{-x}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if z < -1.54999999999999988e46 or 1.4e-57 < z Initial program 90.6%
Taylor expanded in y around 0 62.3%
associate-*r/62.3%
neg-mul-162.3%
*-commutative62.3%
associate-/r*70.6%
Simplified70.6%
if -1.54999999999999988e46 < z < 1.4e-57Initial program 99.9%
Taylor expanded in y around inf 74.9%
Final simplification72.8%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z -1.05e+46) (* (/ -1.0 t) (/ x z)) (if (<= z 2.2e-59) (/ x y) (/ (/ (- x) z) t))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.05e+46) {
tmp = (-1.0 / t) * (x / z);
} else if (z <= 2.2e-59) {
tmp = x / y;
} else {
tmp = (-x / z) / t;
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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.05d+46)) then
tmp = ((-1.0d0) / t) * (x / z)
else if (z <= 2.2d-59) then
tmp = x / y
else
tmp = (-x / z) / t
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.05e+46) {
tmp = (-1.0 / t) * (x / z);
} else if (z <= 2.2e-59) {
tmp = x / y;
} else {
tmp = (-x / z) / t;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if z <= -1.05e+46: tmp = (-1.0 / t) * (x / z) elif z <= 2.2e-59: tmp = x / y else: tmp = (-x / z) / t return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -1.05e+46) tmp = Float64(Float64(-1.0 / t) * Float64(x / z)); elseif (z <= 2.2e-59) tmp = Float64(x / y); else tmp = Float64(Float64(Float64(-x) / z) / t); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= -1.05e+46)
tmp = (-1.0 / t) * (x / z);
elseif (z <= 2.2e-59)
tmp = x / y;
else
tmp = (-x / z) / t;
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, -1.05e+46], N[(N[(-1.0 / t), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e-59], N[(x / y), $MachinePrecision], N[(N[((-x) / z), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+46}:\\
\;\;\;\;\frac{-1}{t} \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-59}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-x}{z}}{t}\\
\end{array}
\end{array}
if z < -1.05e46Initial program 86.3%
Taylor expanded in y around 0 65.5%
associate-*r/65.5%
neg-mul-165.5%
Simplified65.5%
neg-mul-165.5%
times-frac82.1%
Applied egg-rr82.1%
if -1.05e46 < z < 2.1999999999999999e-59Initial program 99.9%
Taylor expanded in y around inf 74.9%
if 2.1999999999999999e-59 < z Initial program 93.5%
Taylor expanded in y around 0 60.0%
associate-*r/60.0%
neg-mul-160.0%
*-commutative60.0%
associate-/r*62.7%
Simplified62.7%
Final simplification72.8%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= t -1.6e-34) (/ x (* z t)) (if (<= t 7.1e+189) (/ x y) (/ (/ x t) z))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.6e-34) {
tmp = x / (z * t);
} else if (t <= 7.1e+189) {
tmp = x / y;
} else {
tmp = (x / t) / z;
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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-34)) then
tmp = x / (z * t)
else if (t <= 7.1d+189) then
tmp = x / y
else
tmp = (x / t) / z
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.6e-34) {
tmp = x / (z * t);
} else if (t <= 7.1e+189) {
tmp = x / y;
} else {
tmp = (x / t) / z;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if t <= -1.6e-34: tmp = x / (z * t) elif t <= 7.1e+189: tmp = x / y else: tmp = (x / t) / z return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= -1.6e-34) tmp = Float64(x / Float64(z * t)); elseif (t <= 7.1e+189) tmp = Float64(x / y); else tmp = Float64(Float64(x / t) / z); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (t <= -1.6e-34)
tmp = x / (z * t);
elseif (t <= 7.1e+189)
tmp = x / y;
else
tmp = (x / t) / z;
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[t, -1.6e-34], N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.1e+189], N[(x / y), $MachinePrecision], N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{-34}:\\
\;\;\;\;\frac{x}{z \cdot t}\\
\mathbf{elif}\;t \leq 7.1 \cdot 10^{+189}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t}}{z}\\
\end{array}
\end{array}
if t < -1.60000000000000001e-34Initial program 92.1%
Taylor expanded in y around 0 63.2%
associate-*r/63.2%
neg-mul-163.2%
Simplified63.2%
associate-/l/68.5%
expm1-log1p-u64.6%
expm1-udef42.1%
associate-/r*42.1%
add-sqr-sqrt15.3%
sqrt-unprod39.5%
sqr-neg39.5%
sqrt-unprod24.4%
add-sqr-sqrt36.5%
Applied egg-rr36.5%
expm1-def33.6%
expm1-log1p34.0%
*-commutative34.0%
Simplified34.0%
if -1.60000000000000001e-34 < t < 7.1e189Initial program 97.9%
Taylor expanded in y around inf 73.0%
if 7.1e189 < t Initial program 89.2%
Taylor expanded in y around 0 83.9%
associate-*r/83.9%
neg-mul-183.9%
Simplified83.9%
associate-/l/89.2%
expm1-log1p-u89.1%
expm1-udef61.1%
associate-/r*66.0%
add-sqr-sqrt48.2%
sqrt-unprod59.9%
sqr-neg59.9%
sqrt-unprod17.8%
add-sqr-sqrt51.8%
Applied egg-rr51.8%
expm1-def46.1%
expm1-log1p46.2%
associate-/r*46.0%
Simplified46.0%
Taylor expanded in x around 0 46.2%
associate-/r*51.5%
Simplified51.5%
Final simplification58.7%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z -1.05e+229) (/ x (* z t)) (/ x y)))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.05e+229) {
tmp = x / (z * t);
} else {
tmp = x / y;
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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.05d+229)) then
tmp = x / (z * t)
else
tmp = x / y
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.05e+229) {
tmp = x / (z * t);
} else {
tmp = x / y;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if z <= -1.05e+229: tmp = x / (z * t) else: tmp = x / y return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -1.05e+229) tmp = Float64(x / Float64(z * t)); else tmp = Float64(x / y); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= -1.05e+229)
tmp = x / (z * t);
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, -1.05e+229], N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+229}:\\
\;\;\;\;\frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if z < -1.04999999999999994e229Initial program 80.5%
Taylor expanded in y around 0 68.7%
associate-*r/68.7%
neg-mul-168.7%
Simplified68.7%
associate-/l/88.2%
expm1-log1p-u88.2%
expm1-udef50.7%
associate-/r*50.7%
add-sqr-sqrt19.3%
sqrt-unprod43.6%
sqr-neg43.6%
sqrt-unprod31.4%
add-sqr-sqrt50.7%
Applied egg-rr50.7%
expm1-def50.2%
expm1-log1p50.2%
*-commutative50.2%
Simplified50.2%
if -1.04999999999999994e229 < z Initial program 96.4%
Taylor expanded in y around inf 62.6%
Final simplification61.8%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z -7.8e+153) (/ (/ x z) t) (/ x y)))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.8e+153) {
tmp = (x / z) / t;
} else {
tmp = x / y;
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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 <= (-7.8d+153)) then
tmp = (x / z) / t
else
tmp = x / y
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.8e+153) {
tmp = (x / z) / t;
} else {
tmp = x / y;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if z <= -7.8e+153: tmp = (x / z) / t else: tmp = x / y return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -7.8e+153) tmp = Float64(Float64(x / z) / t); else tmp = Float64(x / y); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= -7.8e+153)
tmp = (x / z) / t;
else
tmp = x / y;
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, -7.8e+153], N[(N[(x / z), $MachinePrecision] / t), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{+153}:\\
\;\;\;\;\frac{\frac{x}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if z < -7.79999999999999966e153Initial program 88.9%
Taylor expanded in y around 0 75.5%
associate-*r/75.5%
neg-mul-175.5%
Simplified75.5%
associate-/l/90.0%
expm1-log1p-u86.4%
expm1-udef61.6%
associate-/r*61.6%
add-sqr-sqrt25.3%
sqrt-unprod57.6%
sqr-neg57.6%
sqrt-unprod36.4%
add-sqr-sqrt61.7%
Applied egg-rr61.7%
expm1-def54.6%
expm1-log1p54.6%
associate-/r*61.2%
Simplified61.2%
if -7.79999999999999966e153 < z Initial program 96.2%
Taylor expanded in y around inf 64.3%
Final simplification64.0%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (/ x y))
assert(z < t);
double code(double x, double y, double z, double t) {
return x / y;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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
assert z < t;
public static double code(double x, double y, double z, double t) {
return x / y;
}
[z, t] = sort([z, t]) def code(x, y, z, t): return x / y
z, t = sort([z, t]) function code(x, y, z, t) return Float64(x / y) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = x / y;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\frac{x}{y}
\end{array}
Initial program 95.4%
Taylor expanded in y around inf 59.6%
Final simplification59.6%
(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 2023310
(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))))