
(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+160) (/ -1.0 (* t (/ z x))) (/ x (- y (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= -1e+160) {
tmp = -1.0 / (t * (z / x));
} else {
tmp = x / (y - (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+160)) then
tmp = (-1.0d0) / (t * (z / x))
else
tmp = x / (y - (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+160) {
tmp = -1.0 / (t * (z / x));
} else {
tmp = x / (y - (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * t) <= -1e+160: tmp = -1.0 / (t * (z / x)) else: tmp = x / (y - (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * t) <= -1e+160) tmp = Float64(-1.0 / Float64(t * Float64(z / x))); else tmp = Float64(x / Float64(y - Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * t) <= -1e+160) tmp = -1.0 / (t * (z / x)); else tmp = x / (y - (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * t), $MachinePrecision], -1e+160], N[(-1.0 / N[(t * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+160}:\\
\;\;\;\;\frac{-1}{t \cdot \frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\
\end{array}
\end{array}
if (*.f64 z t) < -1.00000000000000001e160Initial program 84.4%
clear-num84.5%
associate-/r/84.5%
Applied egg-rr84.5%
associate-/r/84.5%
clear-num84.4%
sub-neg84.4%
+-commutative84.4%
distribute-lft-neg-in84.4%
add-sqr-sqrt49.0%
associate-*r*49.0%
fma-udef49.0%
frac-2neg49.0%
neg-mul-149.0%
associate-/l*49.0%
add-sqr-sqrt24.6%
sqrt-unprod38.2%
sqr-neg38.2%
sqrt-unprod16.6%
add-sqr-sqrt35.9%
frac-2neg35.9%
Applied egg-rr84.5%
Taylor expanded in y around 0 84.5%
associate-*r/99.9%
Simplified99.9%
if -1.00000000000000001e160 < (*.f64 z t) Initial program 98.5%
Final simplification98.7%
(FPCore (x y z t)
:precision binary64
(if (<= (* z t) -1e+184)
(/ (/ x (- t)) z)
(if (or (<= (* z t) -4e-90) (not (<= (* z t) 100000000.0)))
(- (/ x (* z t)))
(/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= -1e+184) {
tmp = (x / -t) / z;
} else if (((z * t) <= -4e-90) || !((z * t) <= 100000000.0)) {
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 ((z * t) <= (-1d+184)) then
tmp = (x / -t) / z
else if (((z * t) <= (-4d-90)) .or. (.not. ((z * t) <= 100000000.0d0))) 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 ((z * t) <= -1e+184) {
tmp = (x / -t) / z;
} else if (((z * t) <= -4e-90) || !((z * t) <= 100000000.0)) {
tmp = -(x / (z * t));
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * t) <= -1e+184: tmp = (x / -t) / z elif ((z * t) <= -4e-90) or not ((z * t) <= 100000000.0): tmp = -(x / (z * t)) else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * t) <= -1e+184) tmp = Float64(Float64(x / Float64(-t)) / z); elseif ((Float64(z * t) <= -4e-90) || !(Float64(z * t) <= 100000000.0)) 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 ((z * t) <= -1e+184) tmp = (x / -t) / z; elseif (((z * t) <= -4e-90) || ~(((z * t) <= 100000000.0))) tmp = -(x / (z * t)); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * t), $MachinePrecision], -1e+184], N[(N[(x / (-t)), $MachinePrecision] / z), $MachinePrecision], If[Or[LessEqual[N[(z * t), $MachinePrecision], -4e-90], N[Not[LessEqual[N[(z * t), $MachinePrecision], 100000000.0]], $MachinePrecision]], (-N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), N[(x / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+184}:\\
\;\;\;\;\frac{\frac{x}{-t}}{z}\\
\mathbf{elif}\;z \cdot t \leq -4 \cdot 10^{-90} \lor \neg \left(z \cdot t \leq 100000000\right):\\
\;\;\;\;-\frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (*.f64 z t) < -1.00000000000000002e184Initial program 83.1%
Taylor expanded in y around 0 83.1%
associate-*r/83.1%
neg-mul-183.1%
*-commutative83.1%
associate-/r*99.8%
Simplified99.8%
associate-/l/83.1%
neg-mul-183.1%
times-frac99.8%
Applied egg-rr99.8%
associate-*r/99.6%
frac-2neg99.6%
metadata-eval99.6%
associate-*l/99.7%
*-un-lft-identity99.7%
Applied egg-rr99.7%
if -1.00000000000000002e184 < (*.f64 z t) < -3.99999999999999998e-90 or 1e8 < (*.f64 z t) Initial program 97.1%
Taylor expanded in y around 0 75.4%
associate-*r/75.4%
neg-mul-175.4%
Simplified75.4%
if -3.99999999999999998e-90 < (*.f64 z t) < 1e8Initial program 99.9%
Taylor expanded in y around inf 82.8%
Final simplification81.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (* z t) -4e-90) (not (<= (* z t) 100000000.0))) (- (/ x (* z t))) (/ x y)))
double code(double x, double y, double z, double t) {
double tmp;
if (((z * t) <= -4e-90) || !((z * t) <= 100000000.0)) {
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 (((z * t) <= (-4d-90)) .or. (.not. ((z * t) <= 100000000.0d0))) 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 (((z * t) <= -4e-90) || !((z * t) <= 100000000.0)) {
tmp = -(x / (z * t));
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z * t) <= -4e-90) or not ((z * t) <= 100000000.0): tmp = -(x / (z * t)) else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z * t) <= -4e-90) || !(Float64(z * t) <= 100000000.0)) 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 (((z * t) <= -4e-90) || ~(((z * t) <= 100000000.0))) tmp = -(x / (z * t)); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], -4e-90], N[Not[LessEqual[N[(z * t), $MachinePrecision], 100000000.0]], $MachinePrecision]], (-N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -4 \cdot 10^{-90} \lor \neg \left(z \cdot t \leq 100000000\right):\\
\;\;\;\;-\frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (*.f64 z t) < -3.99999999999999998e-90 or 1e8 < (*.f64 z t) Initial program 93.8%
Taylor expanded in y around 0 77.2%
associate-*r/77.2%
neg-mul-177.2%
Simplified77.2%
if -3.99999999999999998e-90 < (*.f64 z t) < 1e8Initial program 99.9%
Taylor expanded in y around inf 82.8%
Final simplification79.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (* z t) -4e-90) (not (<= (* z t) 100000000.0))) (/ (/ (- x) z) t) (/ x y)))
double code(double x, double y, double z, double t) {
double tmp;
if (((z * t) <= -4e-90) || !((z * t) <= 100000000.0)) {
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 (((z * t) <= (-4d-90)) .or. (.not. ((z * t) <= 100000000.0d0))) 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 (((z * t) <= -4e-90) || !((z * t) <= 100000000.0)) {
tmp = (-x / z) / t;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z * t) <= -4e-90) or not ((z * t) <= 100000000.0): tmp = (-x / z) / t else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z * t) <= -4e-90) || !(Float64(z * t) <= 100000000.0)) tmp = Float64(Float64(Float64(-x) / z) / t); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z * t) <= -4e-90) || ~(((z * t) <= 100000000.0))) tmp = (-x / z) / t; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], -4e-90], N[Not[LessEqual[N[(z * t), $MachinePrecision], 100000000.0]], $MachinePrecision]], N[(N[((-x) / z), $MachinePrecision] / t), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -4 \cdot 10^{-90} \lor \neg \left(z \cdot t \leq 100000000\right):\\
\;\;\;\;\frac{\frac{-x}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (*.f64 z t) < -3.99999999999999998e-90 or 1e8 < (*.f64 z t) Initial program 93.8%
Taylor expanded in y around 0 77.2%
associate-*r/77.2%
neg-mul-177.2%
*-commutative77.2%
associate-/r*79.9%
Simplified79.9%
if -3.99999999999999998e-90 < (*.f64 z t) < 1e8Initial program 99.9%
Taylor expanded in y around inf 82.8%
Final simplification81.2%
(FPCore (x y z t) :precision binary64 (if (<= (* z t) -4e-90) (/ -1.0 (* t (/ z x))) (if (<= (* z t) 100000000.0) (/ x y) (/ (/ (- x) z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= -4e-90) {
tmp = -1.0 / (t * (z / x));
} else if ((z * t) <= 100000000.0) {
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 ((z * t) <= (-4d-90)) then
tmp = (-1.0d0) / (t * (z / x))
else if ((z * t) <= 100000000.0d0) 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 ((z * t) <= -4e-90) {
tmp = -1.0 / (t * (z / x));
} else if ((z * t) <= 100000000.0) {
tmp = x / y;
} else {
tmp = (-x / z) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * t) <= -4e-90: tmp = -1.0 / (t * (z / x)) elif (z * t) <= 100000000.0: tmp = x / y else: tmp = (-x / z) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * t) <= -4e-90) tmp = Float64(-1.0 / Float64(t * Float64(z / x))); elseif (Float64(z * t) <= 100000000.0) tmp = Float64(x / y); 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) <= -4e-90) tmp = -1.0 / (t * (z / x)); elseif ((z * t) <= 100000000.0) tmp = x / y; else tmp = (-x / z) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * t), $MachinePrecision], -4e-90], N[(-1.0 / N[(t * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 100000000.0], N[(x / y), $MachinePrecision], N[(N[((-x) / z), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -4 \cdot 10^{-90}:\\
\;\;\;\;\frac{-1}{t \cdot \frac{z}{x}}\\
\mathbf{elif}\;z \cdot t \leq 100000000:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-x}{z}}{t}\\
\end{array}
\end{array}
if (*.f64 z t) < -3.99999999999999998e-90Initial program 93.1%
clear-num93.1%
associate-/r/93.1%
Applied egg-rr93.1%
associate-/r/93.1%
clear-num93.1%
sub-neg93.1%
+-commutative93.1%
distribute-lft-neg-in93.1%
add-sqr-sqrt46.5%
associate-*r*46.6%
fma-udef46.6%
frac-2neg46.6%
neg-mul-146.6%
associate-/l*46.6%
add-sqr-sqrt24.4%
sqrt-unprod27.4%
sqr-neg27.4%
sqrt-unprod8.5%
add-sqr-sqrt17.3%
frac-2neg17.3%
Applied egg-rr74.9%
Taylor expanded in y around 0 72.9%
associate-*r/76.2%
Simplified76.2%
if -3.99999999999999998e-90 < (*.f64 z t) < 1e8Initial program 99.9%
Taylor expanded in y around inf 82.8%
if 1e8 < (*.f64 z t) Initial program 94.9%
Taylor expanded in y around 0 83.7%
associate-*r/83.7%
neg-mul-183.7%
*-commutative83.7%
associate-/r*84.5%
Simplified84.5%
Final simplification81.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.8e+189) (not (<= z 2.3e+63))) (/ x (* z t)) (/ x y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.8e+189) || !(z <= 2.3e+63)) {
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 ((z <= (-1.8d+189)) .or. (.not. (z <= 2.3d+63))) 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 ((z <= -1.8e+189) || !(z <= 2.3e+63)) {
tmp = x / (z * t);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.8e+189) or not (z <= 2.3e+63): tmp = x / (z * t) else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.8e+189) || !(z <= 2.3e+63)) 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 ((z <= -1.8e+189) || ~((z <= 2.3e+63))) tmp = x / (z * t); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.8e+189], N[Not[LessEqual[z, 2.3e+63]], $MachinePrecision]], N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+189} \lor \neg \left(z \leq 2.3 \cdot 10^{+63}\right):\\
\;\;\;\;\frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if z < -1.80000000000000004e189 or 2.29999999999999993e63 < z Initial program 93.0%
Taylor expanded in y around 0 77.5%
associate-*r/77.5%
neg-mul-177.5%
*-commutative77.5%
associate-/r*84.9%
Simplified84.9%
expm1-log1p-u76.9%
expm1-udef58.9%
associate-/r*58.9%
add-sqr-sqrt26.5%
sqrt-unprod50.4%
sqr-neg50.4%
sqrt-unprod25.6%
add-sqr-sqrt49.4%
Applied egg-rr49.4%
expm1-def45.0%
expm1-log1p45.4%
*-commutative45.4%
Simplified45.4%
if -1.80000000000000004e189 < z < 2.29999999999999993e63Initial program 97.8%
Taylor expanded in y around inf 60.6%
Final simplification56.5%
(FPCore (x y z t) :precision binary64 (/ 1.0 (/ y x)))
double code(double x, double y, double z, double t) {
return 1.0 / (y / x);
}
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 = 1.0d0 / (y / x)
end function
public static double code(double x, double y, double z, double t) {
return 1.0 / (y / x);
}
def code(x, y, z, t): return 1.0 / (y / x)
function code(x, y, z, t) return Float64(1.0 / Float64(y / x)) end
function tmp = code(x, y, z, t) tmp = 1.0 / (y / x); end
code[x_, y_, z_, t_] := N[(1.0 / N[(y / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{y}{x}}
\end{array}
Initial program 96.5%
clear-num96.3%
associate-/r/96.3%
Applied egg-rr96.3%
Taylor expanded in y around inf 50.0%
associate-*l/50.2%
associate-/l*50.3%
Applied egg-rr50.3%
Final simplification50.3%
(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.5%
Taylor expanded in y around inf 50.2%
Final simplification50.2%
(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 2024020
(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))))