
(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 10 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
(let* ((t_1 (/ y (+ x 1.0)))
(t_2 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))))
(if (<= t_2 -4e+42)
(/ t_1 (- t (/ x z)))
(if (<= t_2 5e+236) t_2 (+ (/ x (+ x 1.0)) (/ t_1 t))))))
double code(double x, double y, double z, double t) {
double t_1 = y / (x + 1.0);
double t_2 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_2 <= -4e+42) {
tmp = t_1 / (t - (x / z));
} else if (t_2 <= 5e+236) {
tmp = t_2;
} else {
tmp = (x / (x + 1.0)) + (t_1 / 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = y / (x + 1.0d0)
t_2 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0d0)
if (t_2 <= (-4d+42)) then
tmp = t_1 / (t - (x / z))
else if (t_2 <= 5d+236) then
tmp = t_2
else
tmp = (x / (x + 1.0d0)) + (t_1 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y / (x + 1.0);
double t_2 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_2 <= -4e+42) {
tmp = t_1 / (t - (x / z));
} else if (t_2 <= 5e+236) {
tmp = t_2;
} else {
tmp = (x / (x + 1.0)) + (t_1 / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = y / (x + 1.0) t_2 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0) tmp = 0 if t_2 <= -4e+42: tmp = t_1 / (t - (x / z)) elif t_2 <= 5e+236: tmp = t_2 else: tmp = (x / (x + 1.0)) + (t_1 / t) return tmp
function code(x, y, z, t) t_1 = Float64(y / Float64(x + 1.0)) t_2 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)) tmp = 0.0 if (t_2 <= -4e+42) tmp = Float64(t_1 / Float64(t - Float64(x / z))); elseif (t_2 <= 5e+236) tmp = t_2; else tmp = Float64(Float64(x / Float64(x + 1.0)) + Float64(t_1 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y / (x + 1.0); t_2 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0); tmp = 0.0; if (t_2 <= -4e+42) tmp = t_1 / (t - (x / z)); elseif (t_2 <= 5e+236) tmp = t_2; else tmp = (x / (x + 1.0)) + (t_1 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e+42], N[(t$95$1 / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+236], t$95$2, N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{x + 1}\\
t_2 := \frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{+42}:\\
\;\;\;\;\frac{t\_1}{t - \frac{x}{z}}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+236}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1} + \frac{t\_1}{t}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < -4.00000000000000018e42Initial program 76.8%
*-commutative76.8%
Simplified76.8%
Taylor expanded in z around inf 76.8%
mul-1-neg76.8%
unsub-neg76.8%
Simplified76.8%
Taylor expanded in y around inf 94.7%
associate-/r*94.7%
+-commutative94.7%
Simplified94.7%
if -4.00000000000000018e42 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 4.9999999999999997e236Initial program 97.8%
if 4.9999999999999997e236 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 19.7%
*-commutative19.7%
Simplified19.7%
Taylor expanded in t around -inf 79.6%
+-commutative79.6%
mul-1-neg79.6%
unsub-neg79.6%
+-commutative79.6%
Simplified79.6%
Taylor expanded in y around inf 79.6%
associate-*r/79.6%
mul-1-neg79.6%
+-commutative79.6%
Simplified79.6%
Final simplification95.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.3e-28) (not (<= z 4.7e-125))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ x (/ x (- x (* z t)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.3e-28) || !(z <= 4.7e-125)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (x / (x - (z * 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 <= (-2.3d-28)) .or. (.not. (z <= 4.7d-125))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (x + (x / (x - (z * 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 <= -2.3e-28) || !(z <= 4.7e-125)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.3e-28) or not (z <= 4.7e-125): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x + (x / (x - (z * t)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.3e-28) || !(z <= 4.7e-125)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(x / Float64(x - Float64(z * t)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.3e-28) || ~((z <= 4.7e-125))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x + (x / (x - (z * t)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.3e-28], N[Not[LessEqual[z, 4.7e-125]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(x / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{-28} \lor \neg \left(z \leq 4.7 \cdot 10^{-125}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\
\end{array}
\end{array}
if z < -2.29999999999999986e-28 or 4.7e-125 < z Initial program 79.1%
*-commutative79.1%
Simplified79.1%
Taylor expanded in z around inf 82.1%
if -2.29999999999999986e-28 < z < 4.7e-125Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 85.4%
+-commutative85.4%
Simplified85.4%
Final simplification83.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.2e-26) (not (<= z 4.3e-125))) (+ (/ x (+ x 1.0)) (/ (/ y (+ x 1.0)) t)) (/ (+ x (/ x (- x (* z t)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.2e-26) || !(z <= 4.3e-125)) {
tmp = (x / (x + 1.0)) + ((y / (x + 1.0)) / t);
} else {
tmp = (x + (x / (x - (z * 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 <= (-4.2d-26)) .or. (.not. (z <= 4.3d-125))) then
tmp = (x / (x + 1.0d0)) + ((y / (x + 1.0d0)) / t)
else
tmp = (x + (x / (x - (z * 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 <= -4.2e-26) || !(z <= 4.3e-125)) {
tmp = (x / (x + 1.0)) + ((y / (x + 1.0)) / t);
} else {
tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.2e-26) or not (z <= 4.3e-125): tmp = (x / (x + 1.0)) + ((y / (x + 1.0)) / t) else: tmp = (x + (x / (x - (z * t)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.2e-26) || !(z <= 4.3e-125)) tmp = Float64(Float64(x / Float64(x + 1.0)) + Float64(Float64(y / Float64(x + 1.0)) / t)); else tmp = Float64(Float64(x + Float64(x / Float64(x - Float64(z * t)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.2e-26) || ~((z <= 4.3e-125))) tmp = (x / (x + 1.0)) + ((y / (x + 1.0)) / t); else tmp = (x + (x / (x - (z * t)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.2e-26], N[Not[LessEqual[z, 4.3e-125]], $MachinePrecision]], N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(x / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{-26} \lor \neg \left(z \leq 4.3 \cdot 10^{-125}\right):\\
\;\;\;\;\frac{x}{x + 1} + \frac{\frac{y}{x + 1}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\
\end{array}
\end{array}
if z < -4.20000000000000016e-26 or 4.3000000000000002e-125 < z Initial program 79.1%
*-commutative79.1%
Simplified79.1%
Taylor expanded in t around -inf 78.6%
+-commutative78.6%
mul-1-neg78.6%
unsub-neg78.6%
+-commutative78.6%
Simplified78.6%
Taylor expanded in y around inf 82.7%
associate-*r/82.7%
mul-1-neg82.7%
+-commutative82.7%
Simplified82.7%
if -4.20000000000000016e-26 < z < 4.3000000000000002e-125Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 85.4%
+-commutative85.4%
Simplified85.4%
Final simplification83.6%
(FPCore (x y z t) :precision binary64 (if (<= x -2.5e-5) (/ x (+ x 1.0)) (if (<= x 0.0025) (/ (+ x (/ y t)) (+ x 1.0)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.5e-5) {
tmp = x / (x + 1.0);
} else if (x <= 0.0025) {
tmp = (x + (y / t)) / (x + 1.0);
} 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.5d-5)) then
tmp = x / (x + 1.0d0)
else if (x <= 0.0025d0) then
tmp = (x + (y / t)) / (x + 1.0d0)
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.5e-5) {
tmp = x / (x + 1.0);
} else if (x <= 0.0025) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.5e-5: tmp = x / (x + 1.0) elif x <= 0.0025: tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.5e-5) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 0.0025) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.5e-5) tmp = x / (x + 1.0); elseif (x <= 0.0025) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.5e-5], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.0025], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{-5}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 0.0025:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.50000000000000012e-5Initial program 83.5%
*-commutative83.5%
Simplified83.5%
Taylor expanded in t around inf 83.9%
+-commutative83.9%
Simplified83.9%
if -2.50000000000000012e-5 < x < 0.00250000000000000005Initial program 85.8%
*-commutative85.8%
Simplified85.8%
Taylor expanded in z around inf 76.2%
if 0.00250000000000000005 < x Initial program 90.0%
*-commutative90.0%
Simplified90.0%
Taylor expanded in z around inf 78.2%
Taylor expanded in x around inf 93.5%
Final simplification82.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.75e-5) (not (<= x 5.3e-61))) (/ x (+ x 1.0)) (/ y (- t (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.75e-5) || !(x <= 5.3e-61)) {
tmp = x / (x + 1.0);
} else {
tmp = y / (t - (x / 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 ((x <= (-2.75d-5)) .or. (.not. (x <= 5.3d-61))) then
tmp = x / (x + 1.0d0)
else
tmp = y / (t - (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.75e-5) || !(x <= 5.3e-61)) {
tmp = x / (x + 1.0);
} else {
tmp = y / (t - (x / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.75e-5) or not (x <= 5.3e-61): tmp = x / (x + 1.0) else: tmp = y / (t - (x / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.75e-5) || !(x <= 5.3e-61)) tmp = Float64(x / Float64(x + 1.0)); else tmp = Float64(y / Float64(t - Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.75e-5) || ~((x <= 5.3e-61))) tmp = x / (x + 1.0); else tmp = y / (t - (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.75e-5], N[Not[LessEqual[x, 5.3e-61]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.75 \cdot 10^{-5} \lor \neg \left(x \leq 5.3 \cdot 10^{-61}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t - \frac{x}{z}}\\
\end{array}
\end{array}
if x < -2.7500000000000001e-5 or 5.3e-61 < x Initial program 87.7%
*-commutative87.7%
Simplified87.7%
Taylor expanded in t around inf 85.2%
+-commutative85.2%
Simplified85.2%
if -2.7500000000000001e-5 < x < 5.3e-61Initial program 84.4%
*-commutative84.4%
Simplified84.4%
Taylor expanded in z around inf 84.4%
mul-1-neg84.4%
unsub-neg84.4%
Simplified84.4%
Taylor expanded in y around inf 71.0%
associate-/r*71.0%
+-commutative71.0%
Simplified71.0%
Taylor expanded in x around 0 70.3%
Final simplification78.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5e-32) (not (<= x 6.8e-76))) (/ x (+ x 1.0)) (/ y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5e-32) || !(x <= 6.8e-76)) {
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 <= (-5d-32)) .or. (.not. (x <= 6.8d-76))) 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 <= -5e-32) || !(x <= 6.8e-76)) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5e-32) or not (x <= 6.8e-76): tmp = x / (x + 1.0) else: tmp = y / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5e-32) || !(x <= 6.8e-76)) 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 <= -5e-32) || ~((x <= 6.8e-76))) tmp = x / (x + 1.0); else tmp = y / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5e-32], N[Not[LessEqual[x, 6.8e-76]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-32} \lor \neg \left(x \leq 6.8 \cdot 10^{-76}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t}\\
\end{array}
\end{array}
if x < -5e-32 or 6.7999999999999998e-76 < x Initial program 87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in t around inf 83.1%
+-commutative83.1%
Simplified83.1%
if -5e-32 < x < 6.7999999999999998e-76Initial program 84.4%
*-commutative84.4%
Simplified84.4%
Taylor expanded in z around inf 76.2%
Taylor expanded in x around 0 61.0%
Final simplification73.3%
(FPCore (x y z t) :precision binary64 (if (<= x -3.9e-11) 1.0 (if (<= x 2.7e-10) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.9e-11) {
tmp = 1.0;
} else if (x <= 2.7e-10) {
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 <= (-3.9d-11)) then
tmp = 1.0d0
else if (x <= 2.7d-10) 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 <= -3.9e-11) {
tmp = 1.0;
} else if (x <= 2.7e-10) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.9e-11: tmp = 1.0 elif x <= 2.7e-10: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.9e-11) tmp = 1.0; elseif (x <= 2.7e-10) 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 <= -3.9e-11) tmp = 1.0; elseif (x <= 2.7e-10) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.9e-11], 1.0, If[LessEqual[x, 2.7e-10], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{-11}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{-10}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -3.9000000000000001e-11 or 2.7e-10 < x Initial program 86.9%
*-commutative86.9%
Simplified86.9%
Taylor expanded in z around inf 71.4%
Taylor expanded in x around inf 85.3%
if -3.9000000000000001e-11 < x < 2.7e-10Initial program 85.5%
*-commutative85.5%
Simplified85.5%
Taylor expanded in z around inf 75.7%
Taylor expanded in x around 0 56.9%
Final simplification71.0%
(FPCore (x y z t) :precision binary64 (if (<= x -2e-5) (+ 1.0 (/ -1.0 x)) (if (<= x 2.7e-10) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2e-5) {
tmp = 1.0 + (-1.0 / x);
} else if (x <= 2.7e-10) {
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 <= (-2d-5)) then
tmp = 1.0d0 + ((-1.0d0) / x)
else if (x <= 2.7d-10) 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 <= -2e-5) {
tmp = 1.0 + (-1.0 / x);
} else if (x <= 2.7e-10) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2e-5: tmp = 1.0 + (-1.0 / x) elif x <= 2.7e-10: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2e-5) tmp = Float64(1.0 + Float64(-1.0 / x)); elseif (x <= 2.7e-10) 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 <= -2e-5) tmp = 1.0 + (-1.0 / x); elseif (x <= 2.7e-10) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2e-5], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.7e-10], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-5}:\\
\;\;\;\;1 + \frac{-1}{x}\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{-10}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.00000000000000016e-5Initial program 83.5%
*-commutative83.5%
Simplified83.5%
Taylor expanded in t around inf 83.9%
+-commutative83.9%
Simplified83.9%
Taylor expanded in x around inf 81.8%
if -2.00000000000000016e-5 < x < 2.7e-10Initial program 85.5%
*-commutative85.5%
Simplified85.5%
Taylor expanded in z around inf 75.7%
Taylor expanded in x around 0 56.9%
if 2.7e-10 < x Initial program 90.4%
*-commutative90.4%
Simplified90.4%
Taylor expanded in z around inf 79.2%
Taylor expanded in x around inf 89.5%
Final simplification71.1%
(FPCore (x y z t) :precision binary64 (if (<= x -7.8e-10) 1.0 (if (<= x 0.00046) x 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.8e-10) {
tmp = 1.0;
} else if (x <= 0.00046) {
tmp = x;
} 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 <= (-7.8d-10)) then
tmp = 1.0d0
else if (x <= 0.00046d0) then
tmp = x
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 <= -7.8e-10) {
tmp = 1.0;
} else if (x <= 0.00046) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7.8e-10: tmp = 1.0 elif x <= 0.00046: tmp = x else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7.8e-10) tmp = 1.0; elseif (x <= 0.00046) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7.8e-10) tmp = 1.0; elseif (x <= 0.00046) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7.8e-10], 1.0, If[LessEqual[x, 0.00046], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.8 \cdot 10^{-10}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 0.00046:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -7.7999999999999999e-10 or 4.6000000000000001e-4 < x Initial program 86.6%
*-commutative86.6%
Simplified86.6%
Taylor expanded in z around inf 70.8%
Taylor expanded in x around inf 87.1%
if -7.7999999999999999e-10 < x < 4.6000000000000001e-4Initial program 85.8%
*-commutative85.8%
Simplified85.8%
Taylor expanded in t around inf 23.0%
+-commutative23.0%
Simplified23.0%
Taylor expanded in x around 0 21.7%
Final simplification53.4%
(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 86.2%
*-commutative86.2%
Simplified86.2%
Taylor expanded in z around inf 73.6%
Taylor expanded in x around inf 49.4%
Final simplification49.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 2024073
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:alt
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))