
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
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) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
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) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
(FPCore (x y z t)
:precision binary64
(if (<= z -1.12e+192)
(- (+ (/ y (* (+ x 1.0) t)) (/ x (+ x 1.0))) (/ x (* (+ x 1.0) (* z t))))
(if (<= z 5e+127)
(/ (+ x (/ (- (* z y) x) (- (* z t) x))) (+ x 1.0))
(/ (+ x (/ y t)) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.12e+192) {
tmp = ((y / ((x + 1.0) * t)) + (x / (x + 1.0))) - (x / ((x + 1.0) * (z * t)));
} else if (z <= 5e+127) {
tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0);
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
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.12d+192)) then
tmp = ((y / ((x + 1.0d0) * t)) + (x / (x + 1.0d0))) - (x / ((x + 1.0d0) * (z * t)))
else if (z <= 5d+127) then
tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0d0)
else
tmp = (x + (y / t)) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.12e+192) {
tmp = ((y / ((x + 1.0) * t)) + (x / (x + 1.0))) - (x / ((x + 1.0) * (z * t)));
} else if (z <= 5e+127) {
tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0);
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.12e+192: tmp = ((y / ((x + 1.0) * t)) + (x / (x + 1.0))) - (x / ((x + 1.0) * (z * t))) elif z <= 5e+127: tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0) else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.12e+192) tmp = Float64(Float64(Float64(y / Float64(Float64(x + 1.0) * t)) + Float64(x / Float64(x + 1.0))) - Float64(x / Float64(Float64(x + 1.0) * Float64(z * t)))); elseif (z <= 5e+127) tmp = Float64(Float64(x + Float64(Float64(Float64(z * y) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.12e+192) tmp = ((y / ((x + 1.0) * t)) + (x / (x + 1.0))) - (x / ((x + 1.0) * (z * t))); elseif (z <= 5e+127) tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0); else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.12e+192], N[(N[(N[(y / N[(N[(x + 1.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(x + 1.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e+127], N[(N[(x + N[(N[(N[(z * y), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.12 \cdot 10^{+192}:\\
\;\;\;\;\left(\frac{y}{\left(x + 1\right) \cdot t} + \frac{x}{x + 1}\right) - \frac{x}{\left(x + 1\right) \cdot \left(z \cdot t\right)}\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+127}:\\
\;\;\;\;\frac{x + \frac{z \cdot y - x}{z \cdot t - x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}
\end{array}
if z < -1.12e192Initial program 65.1%
*-commutative65.1%
Simplified65.1%
Taylor expanded in t around inf 95.5%
if -1.12e192 < z < 5.0000000000000004e127Initial program 98.8%
if 5.0000000000000004e127 < z Initial program 59.1%
*-commutative59.1%
Simplified59.1%
Taylor expanded in z around inf 92.4%
Final simplification97.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.12e+192) (not (<= z 7.5e+127))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ x (/ (- (* z y) x) (- (* z t) x))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.12e+192) || !(z <= 7.5e+127)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0);
}
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.12d+192)) .or. (.not. (z <= 7.5d+127))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.12e+192) || !(z <= 7.5e+127)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.12e+192) or not (z <= 7.5e+127): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.12e+192) || !(z <= 7.5e+127)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(Float64(Float64(z * y) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.12e+192) || ~((z <= 7.5e+127))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.12e+192], N[Not[LessEqual[z, 7.5e+127]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(N[(N[(z * y), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.12 \cdot 10^{+192} \lor \neg \left(z \leq 7.5 \cdot 10^{+127}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{z \cdot y - x}{z \cdot t - x}}{x + 1}\\
\end{array}
\end{array}
if z < -1.12e192 or 7.4999999999999996e127 < z Initial program 61.8%
*-commutative61.8%
Simplified61.8%
Taylor expanded in z around inf 93.7%
if -1.12e192 < z < 7.4999999999999996e127Initial program 98.8%
Final simplification97.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.35e-41) (not (<= t 8.2e-83))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ x (- 1.0 (/ y (/ x z)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.35e-41) || !(t <= 8.2e-83)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (1.0 - (y / (x / z)))) / (x + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.35d-41)) .or. (.not. (t <= 8.2d-83))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (x + (1.0d0 - (y / (x / z)))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.35e-41) || !(t <= 8.2e-83)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (1.0 - (y / (x / z)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.35e-41) or not (t <= 8.2e-83): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x + (1.0 - (y / (x / z)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.35e-41) || !(t <= 8.2e-83)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(1.0 - Float64(y / Float64(x / z)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.35e-41) || ~((t <= 8.2e-83))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x + (1.0 - (y / (x / z)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.35e-41], N[Not[LessEqual[t, 8.2e-83]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(1.0 - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{-41} \lor \neg \left(t \leq 8.2 \cdot 10^{-83}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \left(1 - \frac{y}{\frac{x}{z}}\right)}{x + 1}\\
\end{array}
\end{array}
if t < -1.35e-41 or 8.1999999999999999e-83 < t Initial program 85.3%
*-commutative85.3%
Simplified85.3%
Taylor expanded in z around inf 88.5%
if -1.35e-41 < t < 8.1999999999999999e-83Initial program 94.2%
*-commutative94.2%
Simplified94.2%
Taylor expanded in t around 0 77.3%
+-commutative77.3%
+-commutative77.3%
associate-+l+77.3%
+-commutative77.3%
mul-1-neg77.3%
unsub-neg77.3%
associate-/l*80.7%
+-commutative80.7%
Simplified80.7%
Final simplification85.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.1e-142) (not (<= t 8.2e-83))) (/ (+ x (/ y t)) (+ x 1.0)) (- 1.0 (* (/ y x) (/ z (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.1e-142) || !(t <= 8.2e-83)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y / x) * (z / (x + 1.0)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-2.1d-142)) .or. (.not. (t <= 8.2d-83))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 - ((y / x) * (z / (x + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.1e-142) || !(t <= 8.2e-83)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y / x) * (z / (x + 1.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.1e-142) or not (t <= 8.2e-83): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 - ((y / x) * (z / (x + 1.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.1e-142) || !(t <= 8.2e-83)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(Float64(y / x) * Float64(z / Float64(x + 1.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.1e-142) || ~((t <= 8.2e-83))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 - ((y / x) * (z / (x + 1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.1e-142], N[Not[LessEqual[t, 8.2e-83]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y / x), $MachinePrecision] * N[(z / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{-142} \lor \neg \left(t \leq 8.2 \cdot 10^{-83}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y}{x} \cdot \frac{z}{x + 1}\\
\end{array}
\end{array}
if t < -2.0999999999999999e-142 or 8.1999999999999999e-83 < t Initial program 85.0%
*-commutative85.0%
Simplified85.0%
Taylor expanded in z around inf 86.0%
if -2.0999999999999999e-142 < t < 8.1999999999999999e-83Initial program 97.1%
*-commutative97.1%
Simplified97.1%
Taylor expanded in t around 0 83.8%
+-commutative83.8%
+-commutative83.8%
associate-+l+83.8%
+-commutative83.8%
mul-1-neg83.8%
unsub-neg83.8%
associate-/l*85.2%
+-commutative85.2%
Simplified85.2%
Taylor expanded in y around 0 83.8%
mul-1-neg83.8%
unsub-neg83.8%
*-commutative83.8%
times-frac83.9%
Simplified83.9%
Final simplification85.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.2e-151) (not (<= t 8.5e-83))) (/ (+ x (/ y t)) (+ x 1.0)) (- 1.0 (* (/ y x) (/ z x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.2e-151) || !(t <= 8.5e-83)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y / x) * (z / x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-3.2d-151)) .or. (.not. (t <= 8.5d-83))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 - ((y / x) * (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.2e-151) || !(t <= 8.5e-83)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y / x) * (z / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.2e-151) or not (t <= 8.5e-83): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 - ((y / x) * (z / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.2e-151) || !(t <= 8.5e-83)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(Float64(y / x) * Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3.2e-151) || ~((t <= 8.5e-83))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 - ((y / x) * (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.2e-151], N[Not[LessEqual[t, 8.5e-83]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y / x), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{-151} \lor \neg \left(t \leq 8.5 \cdot 10^{-83}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y}{x} \cdot \frac{z}{x}\\
\end{array}
\end{array}
if t < -3.20000000000000021e-151 or 8.49999999999999938e-83 < t Initial program 85.0%
*-commutative85.0%
Simplified85.0%
Taylor expanded in z around inf 86.0%
if -3.20000000000000021e-151 < t < 8.49999999999999938e-83Initial program 97.0%
*-commutative97.0%
Simplified97.0%
Taylor expanded in t around 0 83.6%
+-commutative83.6%
+-commutative83.6%
associate-+l+83.6%
+-commutative83.6%
mul-1-neg83.6%
unsub-neg83.6%
associate-/l*85.0%
+-commutative85.0%
Simplified85.0%
Taylor expanded in x around inf 65.5%
mul-1-neg65.5%
unsub-neg65.5%
unpow265.5%
times-frac69.9%
Simplified69.9%
Final simplification81.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.6e-26) (not (<= x 1.65e-114))) (/ x (+ x 1.0)) (/ y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.6e-26) || !(x <= 1.65e-114)) {
tmp = x / (x + 1.0);
} else {
tmp = y / 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 ((x <= (-1.6d-26)) .or. (.not. (x <= 1.65d-114))) then
tmp = x / (x + 1.0d0)
else
tmp = y / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.6e-26) || !(x <= 1.65e-114)) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.6e-26) or not (x <= 1.65e-114): tmp = x / (x + 1.0) else: tmp = y / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.6e-26) || !(x <= 1.65e-114)) tmp = Float64(x / Float64(x + 1.0)); else tmp = Float64(y / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.6e-26) || ~((x <= 1.65e-114))) tmp = x / (x + 1.0); else tmp = y / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.6e-26], N[Not[LessEqual[x, 1.65e-114]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{-26} \lor \neg \left(x \leq 1.65 \cdot 10^{-114}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t}\\
\end{array}
\end{array}
if x < -1.6000000000000001e-26 or 1.65000000000000017e-114 < x Initial program 91.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in t around inf 81.7%
+-commutative81.7%
Simplified81.7%
if -1.6000000000000001e-26 < x < 1.65000000000000017e-114Initial program 83.4%
*-commutative83.4%
Simplified83.4%
Taylor expanded in z around inf 71.0%
Taylor expanded in x around 0 61.9%
Final simplification74.6%
(FPCore (x y z t) :precision binary64 (if (<= x -2.1e-41) 1.0 (if (<= x 8.8e-5) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.1e-41) {
tmp = 1.0;
} else if (x <= 8.8e-5) {
tmp = y / t;
} else {
tmp = 1.0;
}
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 (x <= (-2.1d-41)) then
tmp = 1.0d0
else if (x <= 8.8d-5) then
tmp = y / t
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.1e-41) {
tmp = 1.0;
} else if (x <= 8.8e-5) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.1e-41: tmp = 1.0 elif x <= 8.8e-5: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.1e-41) tmp = 1.0; elseif (x <= 8.8e-5) tmp = Float64(y / t); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.1e-41) tmp = 1.0; elseif (x <= 8.8e-5) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.1e-41], 1.0, If[LessEqual[x, 8.8e-5], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-41}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{-5}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.10000000000000013e-41 or 8.7999999999999998e-5 < x Initial program 90.7%
*-commutative90.7%
Simplified90.7%
Taylor expanded in z around inf 74.2%
Taylor expanded in x around inf 85.3%
if -2.10000000000000013e-41 < x < 8.7999999999999998e-5Initial program 84.9%
*-commutative84.9%
Simplified84.9%
Taylor expanded in z around inf 70.6%
Taylor expanded in x around 0 56.4%
Final simplification73.1%
(FPCore (x y z t) :precision binary64 1.0)
double code(double x, double y, double z, double t) {
return 1.0;
}
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
end function
public static double code(double x, double y, double z, double t) {
return 1.0;
}
def code(x, y, z, t): return 1.0
function code(x, y, z, t) return 1.0 end
function tmp = code(x, y, z, t) tmp = 1.0; end
code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in z around inf 72.7%
Taylor expanded in x around inf 55.4%
Final simplification55.4%
(FPCore (x y z t) :precision binary64 (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0);
}
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 / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0);
}
def code(x, y, z, t): return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(y / Float64(t - Float64(x / z))) - Float64(x / Float64(Float64(t * z) - x)))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1}
\end{array}
herbie shell --seed 2023238
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))