
(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 10 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+212) (/ x (- y (* z t))) (/ (* x (/ -1.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= 1e+212) {
tmp = x / (y - (z * t));
} else {
tmp = (x * (-1.0 / 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+212) then
tmp = x / (y - (z * t))
else
tmp = (x * ((-1.0d0) / 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+212) {
tmp = x / (y - (z * t));
} else {
tmp = (x * (-1.0 / z)) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * t) <= 1e+212: tmp = x / (y - (z * t)) else: tmp = (x * (-1.0 / z)) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * t) <= 1e+212) tmp = Float64(x / Float64(y - Float64(z * t))); else tmp = Float64(Float64(x * Float64(-1.0 / z)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * t) <= 1e+212) tmp = x / (y - (z * t)); else tmp = (x * (-1.0 / z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * t), $MachinePrecision], 1e+212], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq 10^{+212}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{-1}{z}}{t}\\
\end{array}
\end{array}
if (*.f64 z t) < 9.9999999999999991e211Initial program 98.3%
if 9.9999999999999991e211 < (*.f64 z t) Initial program 82.6%
clear-num80.0%
associate-/r/82.6%
Applied egg-rr82.6%
Taylor expanded in y around 0 82.6%
associate-/r*87.2%
div-inv87.2%
Applied egg-rr87.2%
associate-*l/87.3%
associate-*l/99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification98.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (/ (- x) z) t)))
(if (<= (* z t) -1e+43)
t_1
(if (<= (* z t) 5e-29)
(/ x y)
(if (<= (* z t) 2e+30)
(/ (- x) (* z t))
(if (<= (* z t) 2e+49) (/ x y) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (-x / z) / t;
double tmp;
if ((z * t) <= -1e+43) {
tmp = t_1;
} else if ((z * t) <= 5e-29) {
tmp = x / y;
} else if ((z * t) <= 2e+30) {
tmp = -x / (z * t);
} else if ((z * t) <= 2e+49) {
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) :: tmp
t_1 = (-x / z) / t
if ((z * t) <= (-1d+43)) then
tmp = t_1
else if ((z * t) <= 5d-29) then
tmp = x / y
else if ((z * t) <= 2d+30) then
tmp = -x / (z * t)
else if ((z * t) <= 2d+49) 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 tmp;
if ((z * t) <= -1e+43) {
tmp = t_1;
} else if ((z * t) <= 5e-29) {
tmp = x / y;
} else if ((z * t) <= 2e+30) {
tmp = -x / (z * t);
} else if ((z * t) <= 2e+49) {
tmp = x / y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (-x / z) / t tmp = 0 if (z * t) <= -1e+43: tmp = t_1 elif (z * t) <= 5e-29: tmp = x / y elif (z * t) <= 2e+30: tmp = -x / (z * t) elif (z * t) <= 2e+49: tmp = x / y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(-x) / z) / t) tmp = 0.0 if (Float64(z * t) <= -1e+43) tmp = t_1; elseif (Float64(z * t) <= 5e-29) tmp = Float64(x / y); elseif (Float64(z * t) <= 2e+30) tmp = Float64(Float64(-x) / Float64(z * t)); elseif (Float64(z * t) <= 2e+49) 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; tmp = 0.0; if ((z * t) <= -1e+43) tmp = t_1; elseif ((z * t) <= 5e-29) tmp = x / y; elseif ((z * t) <= 2e+30) tmp = -x / (z * t); elseif ((z * t) <= 2e+49) tmp = x / y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[((-x) / z), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1e+43], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e-29], N[(x / y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+30], N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+49], N[(x / y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{-x}{z}}{t}\\
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+43}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-29}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+30}:\\
\;\;\;\;\frac{-x}{z \cdot t}\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+49}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (*.f64 z t) < -1.00000000000000001e43 or 1.99999999999999989e49 < (*.f64 z t) Initial program 91.9%
clear-num90.9%
associate-/r/91.8%
Applied egg-rr91.8%
Taylor expanded in y around 0 82.3%
associate-*l/82.4%
neg-mul-182.4%
*-commutative82.4%
associate-/r*87.5%
Applied egg-rr87.5%
if -1.00000000000000001e43 < (*.f64 z t) < 4.99999999999999986e-29 or 2e30 < (*.f64 z t) < 1.99999999999999989e49Initial program 100.0%
Taylor expanded in y around inf 82.8%
if 4.99999999999999986e-29 < (*.f64 z t) < 2e30Initial program 99.7%
Taylor expanded in y around 0 77.1%
associate-*r/77.1%
neg-mul-177.1%
Simplified77.1%
Final simplification84.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (/ (- x) z) t)))
(if (<= (* z t) -1e+43)
t_1
(if (<= (* z t) 5e-29)
(/ x y)
(if (<= (* z t) 2e+30)
(* x (/ -1.0 (* z t)))
(if (<= (* z t) 2e+49) (/ x y) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (-x / z) / t;
double tmp;
if ((z * t) <= -1e+43) {
tmp = t_1;
} else if ((z * t) <= 5e-29) {
tmp = x / y;
} else if ((z * t) <= 2e+30) {
tmp = x * (-1.0 / (z * t));
} else if ((z * t) <= 2e+49) {
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) :: tmp
t_1 = (-x / z) / t
if ((z * t) <= (-1d+43)) then
tmp = t_1
else if ((z * t) <= 5d-29) then
tmp = x / y
else if ((z * t) <= 2d+30) then
tmp = x * ((-1.0d0) / (z * t))
else if ((z * t) <= 2d+49) 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 tmp;
if ((z * t) <= -1e+43) {
tmp = t_1;
} else if ((z * t) <= 5e-29) {
tmp = x / y;
} else if ((z * t) <= 2e+30) {
tmp = x * (-1.0 / (z * t));
} else if ((z * t) <= 2e+49) {
tmp = x / y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (-x / z) / t tmp = 0 if (z * t) <= -1e+43: tmp = t_1 elif (z * t) <= 5e-29: tmp = x / y elif (z * t) <= 2e+30: tmp = x * (-1.0 / (z * t)) elif (z * t) <= 2e+49: tmp = x / y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(-x) / z) / t) tmp = 0.0 if (Float64(z * t) <= -1e+43) tmp = t_1; elseif (Float64(z * t) <= 5e-29) tmp = Float64(x / y); elseif (Float64(z * t) <= 2e+30) tmp = Float64(x * Float64(-1.0 / Float64(z * t))); elseif (Float64(z * t) <= 2e+49) 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; tmp = 0.0; if ((z * t) <= -1e+43) tmp = t_1; elseif ((z * t) <= 5e-29) tmp = x / y; elseif ((z * t) <= 2e+30) tmp = x * (-1.0 / (z * t)); elseif ((z * t) <= 2e+49) tmp = x / y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[((-x) / z), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1e+43], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e-29], N[(x / y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+30], N[(x * N[(-1.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+49], N[(x / y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{-x}{z}}{t}\\
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+43}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-29}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+30}:\\
\;\;\;\;x \cdot \frac{-1}{z \cdot t}\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+49}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (*.f64 z t) < -1.00000000000000001e43 or 1.99999999999999989e49 < (*.f64 z t) Initial program 91.9%
clear-num90.9%
associate-/r/91.8%
Applied egg-rr91.8%
Taylor expanded in y around 0 82.3%
associate-*l/82.4%
neg-mul-182.4%
*-commutative82.4%
associate-/r*87.5%
Applied egg-rr87.5%
if -1.00000000000000001e43 < (*.f64 z t) < 4.99999999999999986e-29 or 2e30 < (*.f64 z t) < 1.99999999999999989e49Initial program 100.0%
Taylor expanded in y around inf 82.8%
if 4.99999999999999986e-29 < (*.f64 z t) < 2e30Initial program 99.7%
clear-num99.7%
associate-/r/99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 77.2%
Final simplification84.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x) (* z t))))
(if (<= (* z t) -40000000.0)
t_1
(if (<= (* z t) 5e-29)
(/ x y)
(if (<= (* z t) 1e+258) t_1 (/ (/ (- x) t) z))))))
double code(double x, double y, double z, double t) {
double t_1 = -x / (z * t);
double tmp;
if ((z * t) <= -40000000.0) {
tmp = t_1;
} else if ((z * t) <= 5e-29) {
tmp = x / y;
} else if ((z * t) <= 1e+258) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = -x / (z * t)
if ((z * t) <= (-40000000.0d0)) then
tmp = t_1
else if ((z * t) <= 5d-29) then
tmp = x / y
else if ((z * t) <= 1d+258) then
tmp = t_1
else
tmp = (-x / t) / z
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 tmp;
if ((z * t) <= -40000000.0) {
tmp = t_1;
} else if ((z * t) <= 5e-29) {
tmp = x / y;
} else if ((z * t) <= 1e+258) {
tmp = t_1;
} else {
tmp = (-x / t) / z;
}
return tmp;
}
def code(x, y, z, t): t_1 = -x / (z * t) tmp = 0 if (z * t) <= -40000000.0: tmp = t_1 elif (z * t) <= 5e-29: tmp = x / y elif (z * t) <= 1e+258: tmp = t_1 else: tmp = (-x / t) / z return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-x) / Float64(z * t)) tmp = 0.0 if (Float64(z * t) <= -40000000.0) tmp = t_1; elseif (Float64(z * t) <= 5e-29) tmp = Float64(x / y); elseif (Float64(z * t) <= 1e+258) tmp = t_1; else tmp = Float64(Float64(Float64(-x) / t) / z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -x / (z * t); tmp = 0.0; if ((z * t) <= -40000000.0) tmp = t_1; elseif ((z * t) <= 5e-29) tmp = x / y; elseif ((z * t) <= 1e+258) tmp = t_1; else tmp = (-x / t) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -40000000.0], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e-29], N[(x / y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+258], t$95$1, N[(N[((-x) / t), $MachinePrecision] / z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-x}{z \cdot t}\\
\mathbf{if}\;z \cdot t \leq -40000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-29}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;z \cdot t \leq 10^{+258}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-x}{t}}{z}\\
\end{array}
\end{array}
if (*.f64 z t) < -4e7 or 4.99999999999999986e-29 < (*.f64 z t) < 1.00000000000000006e258Initial program 96.6%
Taylor expanded in y around 0 78.7%
associate-*r/78.7%
neg-mul-178.7%
Simplified78.7%
if -4e7 < (*.f64 z t) < 4.99999999999999986e-29Initial program 99.9%
Taylor expanded in y around inf 85.6%
if 1.00000000000000006e258 < (*.f64 z t) Initial program 74.6%
clear-num70.8%
associate-/r/74.5%
Applied egg-rr74.5%
Taylor expanded in y around 0 74.5%
associate-*l/74.6%
neg-mul-174.6%
associate-/r*99.9%
Applied egg-rr99.9%
Final simplification83.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (* z t) -40000000.0) (not (<= (* z t) 5e-29))) (/ (- x) (* z t)) (/ x y)))
double code(double x, double y, double z, double t) {
double tmp;
if (((z * t) <= -40000000.0) || !((z * t) <= 5e-29)) {
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) <= (-40000000.0d0)) .or. (.not. ((z * t) <= 5d-29))) 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) <= -40000000.0) || !((z * t) <= 5e-29)) {
tmp = -x / (z * t);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z * t) <= -40000000.0) or not ((z * t) <= 5e-29): tmp = -x / (z * t) else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z * t) <= -40000000.0) || !(Float64(z * t) <= 5e-29)) 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) <= -40000000.0) || ~(((z * t) <= 5e-29))) 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], -40000000.0], N[Not[LessEqual[N[(z * t), $MachinePrecision], 5e-29]], $MachinePrecision]], N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -40000000 \lor \neg \left(z \cdot t \leq 5 \cdot 10^{-29}\right):\\
\;\;\;\;\frac{-x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (*.f64 z t) < -4e7 or 4.99999999999999986e-29 < (*.f64 z t) Initial program 93.4%
Taylor expanded in y around 0 78.1%
associate-*r/78.1%
neg-mul-178.1%
Simplified78.1%
if -4e7 < (*.f64 z t) < 4.99999999999999986e-29Initial program 99.9%
Taylor expanded in y around inf 85.6%
Final simplification81.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (* z t) -5e+179) (not (<= (* z t) 1.8e+110))) (/ x (* z t)) (/ x y)))
double code(double x, double y, double z, double t) {
double tmp;
if (((z * t) <= -5e+179) || !((z * t) <= 1.8e+110)) {
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) <= (-5d+179)) .or. (.not. ((z * t) <= 1.8d+110))) 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) <= -5e+179) || !((z * t) <= 1.8e+110)) {
tmp = x / (z * t);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z * t) <= -5e+179) or not ((z * t) <= 1.8e+110): tmp = x / (z * t) else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z * t) <= -5e+179) || !(Float64(z * t) <= 1.8e+110)) 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 * t) <= -5e+179) || ~(((z * t) <= 1.8e+110))) 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], -5e+179], N[Not[LessEqual[N[(z * t), $MachinePrecision], 1.8e+110]], $MachinePrecision]], N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+179} \lor \neg \left(z \cdot t \leq 1.8 \cdot 10^{+110}\right):\\
\;\;\;\;\frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (*.f64 z t) < -5e179 or 1.7999999999999998e110 < (*.f64 z t) Initial program 88.7%
clear-num87.5%
associate-/r/88.6%
Applied egg-rr88.6%
Taylor expanded in y around 0 88.6%
associate-/r*91.3%
div-inv91.3%
Applied egg-rr91.3%
un-div-inv91.3%
associate-/l/88.6%
associate-*l/88.7%
neg-mul-188.7%
add-sqr-sqrt45.4%
sqrt-unprod64.4%
sqr-neg64.4%
sqrt-unprod27.1%
add-sqr-sqrt52.6%
Applied egg-rr52.6%
if -5e179 < (*.f64 z t) < 1.7999999999999998e110Initial program 99.9%
Taylor expanded in y around inf 70.8%
Final simplification65.3%
(FPCore (x y z t) :precision binary64 (if (<= (* z t) 5e+264) (/ x (- y (* z t))) (/ (/ (- x) z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= 5e+264) {
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) <= 5d+264) 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) <= 5e+264) {
tmp = x / (y - (z * t));
} else {
tmp = (-x / z) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * t) <= 5e+264: 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) <= 5e+264) 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) <= 5e+264) 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], 5e+264], 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 5 \cdot 10^{+264}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-x}{z}}{t}\\
\end{array}
\end{array}
if (*.f64 z t) < 5.00000000000000033e264Initial program 98.3%
if 5.00000000000000033e264 < (*.f64 z t) Initial program 71.6%
clear-num67.5%
associate-/r/71.6%
Applied egg-rr71.6%
Taylor expanded in y around 0 71.6%
associate-*l/71.6%
neg-mul-171.6%
*-commutative71.6%
associate-/r*99.8%
Applied egg-rr99.8%
Final simplification98.4%
(FPCore (x y z t) :precision binary64 (if (<= (* z t) 1e+258) (/ x (- y (* z t))) (/ (* x (/ -1.0 t)) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= 1e+258) {
tmp = x / (y - (z * t));
} 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 ((z * t) <= 1d+258) then
tmp = x / (y - (z * t))
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 ((z * t) <= 1e+258) {
tmp = x / (y - (z * t));
} else {
tmp = (x * (-1.0 / t)) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * t) <= 1e+258: tmp = x / (y - (z * t)) else: tmp = (x * (-1.0 / t)) / z return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * t) <= 1e+258) tmp = Float64(x / Float64(y - Float64(z * t))); else tmp = Float64(Float64(x * Float64(-1.0 / t)) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * t) <= 1e+258) tmp = x / (y - (z * t)); else tmp = (x * (-1.0 / t)) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * t), $MachinePrecision], 1e+258], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq 10^{+258}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{-1}{t}}{z}\\
\end{array}
\end{array}
if (*.f64 z t) < 1.00000000000000006e258Initial program 98.3%
if 1.00000000000000006e258 < (*.f64 z t) Initial program 74.6%
clear-num70.8%
associate-/r/74.5%
Applied egg-rr74.5%
Taylor expanded in y around 0 74.5%
associate-/r*81.5%
associate-*l/99.9%
Applied egg-rr99.9%
Final simplification98.4%
(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.0%
associate-/r/96.4%
Applied egg-rr96.4%
Taylor expanded in y around inf 54.1%
associate-*l/54.2%
associate-/l*54.3%
Applied egg-rr54.3%
Final simplification54.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 54.2%
Final simplification54.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 2023182
(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))))