
(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 6 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 (/ 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}
Initial program 96.8%
(FPCore (x y z t)
:precision binary64
(if (<= y -4.9e-45)
(/ x y)
(if (<= y -7e-84)
(/ (- x) (* z t))
(if (<= y -1.48e-102)
(/ (/ x t) (- z))
(if (<= y -5.8e-183)
(/ (/ x z) (- t))
(if (or (<= y -6.2e-213)
(not
(or (<= y -3.5e-299)
(and (not (<= y -3.3e-299)) (<= y 4.1e-45)))))
(/ x y)
(* x (/ (/ -1.0 t) z))))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.9e-45) {
tmp = x / y;
} else if (y <= -7e-84) {
tmp = -x / (z * t);
} else if (y <= -1.48e-102) {
tmp = (x / t) / -z;
} else if (y <= -5.8e-183) {
tmp = (x / z) / -t;
} else if ((y <= -6.2e-213) || !((y <= -3.5e-299) || (!(y <= -3.3e-299) && (y <= 4.1e-45)))) {
tmp = x / y;
} else {
tmp = x * ((-1.0 / 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 <= (-4.9d-45)) then
tmp = x / y
else if (y <= (-7d-84)) then
tmp = -x / (z * t)
else if (y <= (-1.48d-102)) then
tmp = (x / t) / -z
else if (y <= (-5.8d-183)) then
tmp = (x / z) / -t
else if ((y <= (-6.2d-213)) .or. (.not. (y <= (-3.5d-299)) .or. (.not. (y <= (-3.3d-299))) .and. (y <= 4.1d-45))) then
tmp = x / y
else
tmp = x * (((-1.0d0) / t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.9e-45) {
tmp = x / y;
} else if (y <= -7e-84) {
tmp = -x / (z * t);
} else if (y <= -1.48e-102) {
tmp = (x / t) / -z;
} else if (y <= -5.8e-183) {
tmp = (x / z) / -t;
} else if ((y <= -6.2e-213) || !((y <= -3.5e-299) || (!(y <= -3.3e-299) && (y <= 4.1e-45)))) {
tmp = x / y;
} else {
tmp = x * ((-1.0 / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4.9e-45: tmp = x / y elif y <= -7e-84: tmp = -x / (z * t) elif y <= -1.48e-102: tmp = (x / t) / -z elif y <= -5.8e-183: tmp = (x / z) / -t elif (y <= -6.2e-213) or not ((y <= -3.5e-299) or (not (y <= -3.3e-299) and (y <= 4.1e-45))): tmp = x / y else: tmp = x * ((-1.0 / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4.9e-45) tmp = Float64(x / y); elseif (y <= -7e-84) tmp = Float64(Float64(-x) / Float64(z * t)); elseif (y <= -1.48e-102) tmp = Float64(Float64(x / t) / Float64(-z)); elseif (y <= -5.8e-183) tmp = Float64(Float64(x / z) / Float64(-t)); elseif ((y <= -6.2e-213) || !((y <= -3.5e-299) || (!(y <= -3.3e-299) && (y <= 4.1e-45)))) tmp = Float64(x / y); else tmp = Float64(x * Float64(Float64(-1.0 / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4.9e-45) tmp = x / y; elseif (y <= -7e-84) tmp = -x / (z * t); elseif (y <= -1.48e-102) tmp = (x / t) / -z; elseif (y <= -5.8e-183) tmp = (x / z) / -t; elseif ((y <= -6.2e-213) || ~(((y <= -3.5e-299) || (~((y <= -3.3e-299)) && (y <= 4.1e-45))))) tmp = x / y; else tmp = x * ((-1.0 / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.9e-45], N[(x / y), $MachinePrecision], If[LessEqual[y, -7e-84], N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.48e-102], N[(N[(x / t), $MachinePrecision] / (-z)), $MachinePrecision], If[LessEqual[y, -5.8e-183], N[(N[(x / z), $MachinePrecision] / (-t)), $MachinePrecision], If[Or[LessEqual[y, -6.2e-213], N[Not[Or[LessEqual[y, -3.5e-299], And[N[Not[LessEqual[y, -3.3e-299]], $MachinePrecision], LessEqual[y, 4.1e-45]]]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(x * N[(N[(-1.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.9 \cdot 10^{-45}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq -7 \cdot 10^{-84}:\\
\;\;\;\;\frac{-x}{z \cdot t}\\
\mathbf{elif}\;y \leq -1.48 \cdot 10^{-102}:\\
\;\;\;\;\frac{\frac{x}{t}}{-z}\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-183}:\\
\;\;\;\;\frac{\frac{x}{z}}{-t}\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{-213} \lor \neg \left(y \leq -3.5 \cdot 10^{-299} \lor \neg \left(y \leq -3.3 \cdot 10^{-299}\right) \land y \leq 4.1 \cdot 10^{-45}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{-1}{t}}{z}\\
\end{array}
\end{array}
if y < -4.8999999999999998e-45 or -5.8000000000000001e-183 < y < -6.1999999999999996e-213 or -3.49999999999999991e-299 < y < -3.3000000000000002e-299 or 4.0999999999999999e-45 < y Initial program 97.5%
Taylor expanded in y around inf 80.7%
if -4.8999999999999998e-45 < y < -7.0000000000000002e-84Initial program 99.7%
Taylor expanded in y around 0 78.8%
associate-*r/78.8%
neg-mul-178.8%
Simplified78.8%
if -7.0000000000000002e-84 < y < -1.48e-102Initial program 75.8%
clear-num76.2%
associate-/r/76.2%
Applied egg-rr76.2%
Taylor expanded in y around 0 75.8%
mul-1-neg75.8%
associate-/r*75.8%
distribute-neg-frac275.8%
Simplified75.8%
if -1.48e-102 < y < -5.8000000000000001e-183Initial program 93.5%
Taylor expanded in t around -inf 78.6%
Taylor expanded in z around inf 81.4%
if -6.1999999999999996e-213 < y < -3.49999999999999991e-299 or -3.3000000000000002e-299 < y < 4.0999999999999999e-45Initial program 96.9%
clear-num96.7%
associate-/r/96.9%
Applied egg-rr96.9%
Taylor expanded in y around 0 78.7%
associate-/r*78.8%
Simplified78.8%
Final simplification80.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (/ x z) (- t))) (t_2 (/ (- x) (* z t))))
(if (<= y -1.26e-46)
(/ x y)
(if (<= y -1.3e-86)
t_2
(if (<= y -3.6e-102)
(/ (/ x t) (- z))
(if (<= y -5.8e-183)
t_1
(if (<= y -6.2e-213)
(/ x y)
(if (<= y -3.5e-299)
t_1
(if (or (<= y -3.3e-299) (not (<= y 8e-49)))
(/ x y)
t_2)))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / z) / -t;
double t_2 = -x / (z * t);
double tmp;
if (y <= -1.26e-46) {
tmp = x / y;
} else if (y <= -1.3e-86) {
tmp = t_2;
} else if (y <= -3.6e-102) {
tmp = (x / t) / -z;
} else if (y <= -5.8e-183) {
tmp = t_1;
} else if (y <= -6.2e-213) {
tmp = x / y;
} else if (y <= -3.5e-299) {
tmp = t_1;
} else if ((y <= -3.3e-299) || !(y <= 8e-49)) {
tmp = x / y;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (x / z) / -t
t_2 = -x / (z * t)
if (y <= (-1.26d-46)) then
tmp = x / y
else if (y <= (-1.3d-86)) then
tmp = t_2
else if (y <= (-3.6d-102)) then
tmp = (x / t) / -z
else if (y <= (-5.8d-183)) then
tmp = t_1
else if (y <= (-6.2d-213)) then
tmp = x / y
else if (y <= (-3.5d-299)) then
tmp = t_1
else if ((y <= (-3.3d-299)) .or. (.not. (y <= 8d-49))) then
tmp = x / y
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / z) / -t;
double t_2 = -x / (z * t);
double tmp;
if (y <= -1.26e-46) {
tmp = x / y;
} else if (y <= -1.3e-86) {
tmp = t_2;
} else if (y <= -3.6e-102) {
tmp = (x / t) / -z;
} else if (y <= -5.8e-183) {
tmp = t_1;
} else if (y <= -6.2e-213) {
tmp = x / y;
} else if (y <= -3.5e-299) {
tmp = t_1;
} else if ((y <= -3.3e-299) || !(y <= 8e-49)) {
tmp = x / y;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / z) / -t t_2 = -x / (z * t) tmp = 0 if y <= -1.26e-46: tmp = x / y elif y <= -1.3e-86: tmp = t_2 elif y <= -3.6e-102: tmp = (x / t) / -z elif y <= -5.8e-183: tmp = t_1 elif y <= -6.2e-213: tmp = x / y elif y <= -3.5e-299: tmp = t_1 elif (y <= -3.3e-299) or not (y <= 8e-49): tmp = x / y else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / z) / Float64(-t)) t_2 = Float64(Float64(-x) / Float64(z * t)) tmp = 0.0 if (y <= -1.26e-46) tmp = Float64(x / y); elseif (y <= -1.3e-86) tmp = t_2; elseif (y <= -3.6e-102) tmp = Float64(Float64(x / t) / Float64(-z)); elseif (y <= -5.8e-183) tmp = t_1; elseif (y <= -6.2e-213) tmp = Float64(x / y); elseif (y <= -3.5e-299) tmp = t_1; elseif ((y <= -3.3e-299) || !(y <= 8e-49)) tmp = Float64(x / y); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / z) / -t; t_2 = -x / (z * t); tmp = 0.0; if (y <= -1.26e-46) tmp = x / y; elseif (y <= -1.3e-86) tmp = t_2; elseif (y <= -3.6e-102) tmp = (x / t) / -z; elseif (y <= -5.8e-183) tmp = t_1; elseif (y <= -6.2e-213) tmp = x / y; elseif (y <= -3.5e-299) tmp = t_1; elseif ((y <= -3.3e-299) || ~((y <= 8e-49))) tmp = x / y; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] / (-t)), $MachinePrecision]}, Block[{t$95$2 = N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.26e-46], N[(x / y), $MachinePrecision], If[LessEqual[y, -1.3e-86], t$95$2, If[LessEqual[y, -3.6e-102], N[(N[(x / t), $MachinePrecision] / (-z)), $MachinePrecision], If[LessEqual[y, -5.8e-183], t$95$1, If[LessEqual[y, -6.2e-213], N[(x / y), $MachinePrecision], If[LessEqual[y, -3.5e-299], t$95$1, If[Or[LessEqual[y, -3.3e-299], N[Not[LessEqual[y, 8e-49]], $MachinePrecision]], N[(x / y), $MachinePrecision], t$95$2]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{x}{z}}{-t}\\
t_2 := \frac{-x}{z \cdot t}\\
\mathbf{if}\;y \leq -1.26 \cdot 10^{-46}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq -1.3 \cdot 10^{-86}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -3.6 \cdot 10^{-102}:\\
\;\;\;\;\frac{\frac{x}{t}}{-z}\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-183}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{-213}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq -3.5 \cdot 10^{-299}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -3.3 \cdot 10^{-299} \lor \neg \left(y \leq 8 \cdot 10^{-49}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -1.26000000000000004e-46 or -5.8000000000000001e-183 < y < -6.1999999999999996e-213 or -3.49999999999999991e-299 < y < -3.3000000000000002e-299 or 7.99999999999999949e-49 < y Initial program 97.5%
Taylor expanded in y around inf 80.3%
if -1.26000000000000004e-46 < y < -1.3000000000000001e-86 or -3.3000000000000002e-299 < y < 7.99999999999999949e-49Initial program 96.7%
Taylor expanded in y around 0 76.2%
associate-*r/76.2%
neg-mul-176.2%
Simplified76.2%
if -1.3000000000000001e-86 < y < -3.6e-102Initial program 75.8%
clear-num76.2%
associate-/r/76.2%
Applied egg-rr76.2%
Taylor expanded in y around 0 75.8%
mul-1-neg75.8%
associate-/r*75.8%
distribute-neg-frac275.8%
Simplified75.8%
if -3.6e-102 < y < -5.8000000000000001e-183 or -6.1999999999999996e-213 < y < -3.49999999999999991e-299Initial program 96.2%
Taylor expanded in t around -inf 66.8%
Taylor expanded in z around inf 75.5%
Final simplification78.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x) (* z t))) (t_2 (/ (/ x t) (- z))))
(if (<= z -1.7e+224)
t_2
(if (<= z -1.45e+130)
t_1
(if (<= z -7.5e+45)
(/ x y)
(if (<= z -1.6e+31) t_2 (if (<= z 5.5e-122) (/ x y) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = -x / (z * t);
double t_2 = (x / t) / -z;
double tmp;
if (z <= -1.7e+224) {
tmp = t_2;
} else if (z <= -1.45e+130) {
tmp = t_1;
} else if (z <= -7.5e+45) {
tmp = x / y;
} else if (z <= -1.6e+31) {
tmp = t_2;
} else if (z <= 5.5e-122) {
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) :: t_2
real(8) :: tmp
t_1 = -x / (z * t)
t_2 = (x / t) / -z
if (z <= (-1.7d+224)) then
tmp = t_2
else if (z <= (-1.45d+130)) then
tmp = t_1
else if (z <= (-7.5d+45)) then
tmp = x / y
else if (z <= (-1.6d+31)) then
tmp = t_2
else if (z <= 5.5d-122) 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 / (z * t);
double t_2 = (x / t) / -z;
double tmp;
if (z <= -1.7e+224) {
tmp = t_2;
} else if (z <= -1.45e+130) {
tmp = t_1;
} else if (z <= -7.5e+45) {
tmp = x / y;
} else if (z <= -1.6e+31) {
tmp = t_2;
} else if (z <= 5.5e-122) {
tmp = x / y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = -x / (z * t) t_2 = (x / t) / -z tmp = 0 if z <= -1.7e+224: tmp = t_2 elif z <= -1.45e+130: tmp = t_1 elif z <= -7.5e+45: tmp = x / y elif z <= -1.6e+31: tmp = t_2 elif z <= 5.5e-122: tmp = x / y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-x) / Float64(z * t)) t_2 = Float64(Float64(x / t) / Float64(-z)) tmp = 0.0 if (z <= -1.7e+224) tmp = t_2; elseif (z <= -1.45e+130) tmp = t_1; elseif (z <= -7.5e+45) tmp = Float64(x / y); elseif (z <= -1.6e+31) tmp = t_2; elseif (z <= 5.5e-122) tmp = Float64(x / y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -x / (z * t); t_2 = (x / t) / -z; tmp = 0.0; if (z <= -1.7e+224) tmp = t_2; elseif (z <= -1.45e+130) tmp = t_1; elseif (z <= -7.5e+45) tmp = x / y; elseif (z <= -1.6e+31) tmp = t_2; elseif (z <= 5.5e-122) tmp = x / y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / t), $MachinePrecision] / (-z)), $MachinePrecision]}, If[LessEqual[z, -1.7e+224], t$95$2, If[LessEqual[z, -1.45e+130], t$95$1, If[LessEqual[z, -7.5e+45], N[(x / y), $MachinePrecision], If[LessEqual[z, -1.6e+31], t$95$2, If[LessEqual[z, 5.5e-122], N[(x / y), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-x}{z \cdot t}\\
t_2 := \frac{\frac{x}{t}}{-z}\\
\mathbf{if}\;z \leq -1.7 \cdot 10^{+224}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -1.45 \cdot 10^{+130}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -7.5 \cdot 10^{+45}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{+31}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-122}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.7000000000000001e224 or -7.50000000000000058e45 < z < -1.6e31Initial program 86.6%
clear-num86.4%
associate-/r/86.6%
Applied egg-rr86.6%
Taylor expanded in y around 0 69.4%
mul-1-neg69.4%
associate-/r*82.4%
distribute-neg-frac282.4%
Simplified82.4%
if -1.7000000000000001e224 < z < -1.45e130 or 5.50000000000000053e-122 < z Initial program 95.2%
Taylor expanded in y around 0 59.2%
associate-*r/59.2%
neg-mul-159.2%
Simplified59.2%
if -1.45e130 < z < -7.50000000000000058e45 or -1.6e31 < z < 5.50000000000000053e-122Initial program 99.1%
Taylor expanded in y around inf 74.2%
Final simplification68.6%
(FPCore (x y z t)
:precision binary64
(if (or (<= y -1.95e-41)
(and (not (<= y -1.2e-150))
(or (<= y -6.2e-213) (not (<= y 5.2e-67)))))
(/ x y)
(/ (- x) (* z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.95e-41) || (!(y <= -1.2e-150) && ((y <= -6.2e-213) || !(y <= 5.2e-67)))) {
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.95d-41)) .or. (.not. (y <= (-1.2d-150))) .and. (y <= (-6.2d-213)) .or. (.not. (y <= 5.2d-67))) 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.95e-41) || (!(y <= -1.2e-150) && ((y <= -6.2e-213) || !(y <= 5.2e-67)))) {
tmp = x / y;
} else {
tmp = -x / (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.95e-41) or (not (y <= -1.2e-150) and ((y <= -6.2e-213) or not (y <= 5.2e-67))): tmp = x / y else: tmp = -x / (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.95e-41) || (!(y <= -1.2e-150) && ((y <= -6.2e-213) || !(y <= 5.2e-67)))) 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.95e-41) || (~((y <= -1.2e-150)) && ((y <= -6.2e-213) || ~((y <= 5.2e-67))))) tmp = x / y; else tmp = -x / (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.95e-41], And[N[Not[LessEqual[y, -1.2e-150]], $MachinePrecision], Or[LessEqual[y, -6.2e-213], N[Not[LessEqual[y, 5.2e-67]], $MachinePrecision]]]], N[(x / y), $MachinePrecision], N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{-41} \lor \neg \left(y \leq -1.2 \cdot 10^{-150}\right) \land \left(y \leq -6.2 \cdot 10^{-213} \lor \neg \left(y \leq 5.2 \cdot 10^{-67}\right)\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{z \cdot t}\\
\end{array}
\end{array}
if y < -1.94999999999999995e-41 or -1.2e-150 < y < -6.1999999999999996e-213 or 5.1999999999999998e-67 < y Initial program 97.0%
Taylor expanded in y around inf 77.5%
if -1.94999999999999995e-41 < y < -1.2e-150 or -6.1999999999999996e-213 < y < 5.1999999999999998e-67Initial program 96.5%
Taylor expanded in y around 0 78.5%
associate-*r/78.5%
neg-mul-178.5%
Simplified78.5%
Final simplification77.8%
(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 96.8%
Taylor expanded in y around inf 58.4%
(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 2024103
(FPCore (x y z t)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, B"
:precision binary64
:alt
(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))))