
(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 11 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 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))))
(if (<= t_1 -4e+18)
(* (/ y (+ x 1.0)) (/ z (fma t z (- x))))
(if (<= t_1 INFINITY) t_1 (/ (+ x (/ y t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= -4e+18) {
tmp = (y / (x + 1.0)) * (z / fma(t, z, -x));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= -4e+18) tmp = Float64(Float64(y / Float64(x + 1.0)) * Float64(z / fma(t, z, Float64(-x)))); elseif (t_1 <= Inf) tmp = t_1; else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = 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$1, -4e+18], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(z / N[(t * z + (-x)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+18}:\\
\;\;\;\;\frac{y}{x + 1} \cdot \frac{z}{\mathsf{fma}\left(t, z, -x\right)}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -4e18Initial program 82.0%
*-commutative82.0%
Simplified82.0%
Taylor expanded in y around inf 81.7%
times-frac94.7%
+-commutative94.7%
fma-neg94.7%
Simplified94.7%
if -4e18 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < +inf.0Initial program 97.2%
if +inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in z around inf 100.0%
Final simplification96.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0)))) (if (<= t_1 INFINITY) t_1 (/ (+ x (/ y t)) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = 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$1, Infinity], t$95$1, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < +inf.0Initial program 94.9%
if +inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in z around inf 100.0%
Final simplification95.0%
(FPCore (x y z t)
:precision binary64
(if (<= x -1.15e-46)
(- 1.0 (/ (* z (/ y x)) (+ x 1.0)))
(if (<= x 2.3e-69)
(/ (+ x (/ (- y (/ x z)) 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 (x <= -1.15e-46) {
tmp = 1.0 - ((z * (y / x)) / (x + 1.0));
} else if (x <= 2.3e-69) {
tmp = (x + ((y - (x / z)) / 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 (x <= (-1.15d-46)) then
tmp = 1.0d0 - ((z * (y / x)) / (x + 1.0d0))
else if (x <= 2.3d-69) then
tmp = (x + ((y - (x / z)) / 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 (x <= -1.15e-46) {
tmp = 1.0 - ((z * (y / x)) / (x + 1.0));
} else if (x <= 2.3e-69) {
tmp = (x + ((y - (x / z)) / 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 x <= -1.15e-46: tmp = 1.0 - ((z * (y / x)) / (x + 1.0)) elif x <= 2.3e-69: tmp = (x + ((y - (x / z)) / 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 (x <= -1.15e-46) tmp = Float64(1.0 - Float64(Float64(z * Float64(y / x)) / Float64(x + 1.0))); elseif (x <= 2.3e-69) tmp = Float64(Float64(x + Float64(Float64(y - Float64(x / z)) / 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 (x <= -1.15e-46) tmp = 1.0 - ((z * (y / x)) / (x + 1.0)); elseif (x <= 2.3e-69) tmp = (x + ((y - (x / z)) / 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[LessEqual[x, -1.15e-46], N[(1.0 - N[(N[(z * N[(y / x), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.3e-69], N[(N[(x + N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / 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}\;x \leq -1.15 \cdot 10^{-46}:\\
\;\;\;\;1 - \frac{z \cdot \frac{y}{x}}{x + 1}\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-69}:\\
\;\;\;\;\frac{x + \frac{y - \frac{x}{z}}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y}{x} \cdot \frac{z}{x + 1}\\
\end{array}
\end{array}
if x < -1.15e-46Initial program 93.2%
*-commutative93.2%
Simplified93.2%
Taylor expanded in t around 0 82.1%
associate-+r+82.1%
mul-1-neg82.1%
unsub-neg82.1%
+-commutative82.1%
associate-/l*87.7%
+-commutative87.7%
Simplified87.7%
div-sub87.7%
pow187.7%
pow187.7%
pow-div87.7%
metadata-eval87.7%
metadata-eval87.7%
associate-/r/87.7%
Applied egg-rr87.7%
if -1.15e-46 < x < 2.3000000000000001e-69Initial program 91.9%
*-commutative91.9%
Simplified91.9%
Taylor expanded in t around inf 61.9%
Taylor expanded in y around 0 69.7%
mul-1-neg69.7%
+-commutative69.7%
sub-neg69.7%
*-commutative69.7%
associate-/r*69.9%
div-sub69.9%
Simplified69.9%
if 2.3000000000000001e-69 < x Initial program 94.3%
*-commutative94.3%
Simplified94.3%
Taylor expanded in t around 0 84.6%
associate-+r+84.6%
mul-1-neg84.6%
unsub-neg84.6%
+-commutative84.6%
associate-/l*88.9%
+-commutative88.9%
Simplified88.9%
Taylor expanded in y around 0 84.5%
mul-1-neg84.5%
sub-neg84.5%
times-frac88.9%
+-commutative88.9%
Simplified88.9%
Final simplification81.2%
(FPCore (x y z t)
:precision binary64
(if (<= t -6.8e-6)
(/ (+ x (/ y t)) (+ x 1.0))
(if (<= t 5.4e-11)
(/ (- (+ x 1.0) (/ y (/ x z))) (+ x 1.0))
(/ (- x (/ x (- (* z t) x))) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6.8e-6) {
tmp = (x + (y / t)) / (x + 1.0);
} else if (t <= 5.4e-11) {
tmp = ((x + 1.0) - (y / (x / z))) / (x + 1.0);
} else {
tmp = (x - (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 (t <= (-6.8d-6)) then
tmp = (x + (y / t)) / (x + 1.0d0)
else if (t <= 5.4d-11) then
tmp = ((x + 1.0d0) - (y / (x / z))) / (x + 1.0d0)
else
tmp = (x - (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 (t <= -6.8e-6) {
tmp = (x + (y / t)) / (x + 1.0);
} else if (t <= 5.4e-11) {
tmp = ((x + 1.0) - (y / (x / z))) / (x + 1.0);
} else {
tmp = (x - (x / ((z * t) - x))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -6.8e-6: tmp = (x + (y / t)) / (x + 1.0) elif t <= 5.4e-11: tmp = ((x + 1.0) - (y / (x / z))) / (x + 1.0) else: tmp = (x - (x / ((z * t) - x))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -6.8e-6) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); elseif (t <= 5.4e-11) tmp = Float64(Float64(Float64(x + 1.0) - Float64(y / Float64(x / z))) / Float64(x + 1.0)); else tmp = Float64(Float64(x - Float64(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 (t <= -6.8e-6) tmp = (x + (y / t)) / (x + 1.0); elseif (t <= 5.4e-11) tmp = ((x + 1.0) - (y / (x / z))) / (x + 1.0); else tmp = (x - (x / ((z * t) - x))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -6.8e-6], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.4e-11], N[(N[(N[(x + 1.0), $MachinePrecision] - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(x / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.8 \cdot 10^{-6}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{elif}\;t \leq 5.4 \cdot 10^{-11}:\\
\;\;\;\;\frac{\left(x + 1\right) - \frac{y}{\frac{x}{z}}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \frac{x}{z \cdot t - x}}{x + 1}\\
\end{array}
\end{array}
if t < -6.80000000000000012e-6Initial program 91.8%
*-commutative91.8%
Simplified91.8%
Taylor expanded in z around inf 87.0%
if -6.80000000000000012e-6 < t < 5.40000000000000009e-11Initial program 93.8%
*-commutative93.8%
Simplified93.8%
Taylor expanded in t around 0 77.3%
associate-+r+77.3%
mul-1-neg77.3%
unsub-neg77.3%
+-commutative77.3%
associate-/l*81.9%
+-commutative81.9%
Simplified81.9%
if 5.40000000000000009e-11 < t Initial program 92.7%
*-commutative92.7%
Simplified92.7%
Taylor expanded in y around 0 84.5%
Final simplification83.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.2e-5) (not (<= t 2.4e-9))) (/ (+ 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 <= -1.2e-5) || !(t <= 2.4e-9)) {
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 <= (-1.2d-5)) .or. (.not. (t <= 2.4d-9))) 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 <= -1.2e-5) || !(t <= 2.4e-9)) {
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 <= -1.2e-5) or not (t <= 2.4e-9): 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 <= -1.2e-5) || !(t <= 2.4e-9)) 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 <= -1.2e-5) || ~((t <= 2.4e-9))) 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, -1.2e-5], N[Not[LessEqual[t, 2.4e-9]], $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 -1.2 \cdot 10^{-5} \lor \neg \left(t \leq 2.4 \cdot 10^{-9}\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 < -1.2e-5 or 2.4e-9 < t Initial program 92.1%
*-commutative92.1%
Simplified92.1%
Taylor expanded in z around inf 85.8%
if -1.2e-5 < t < 2.4e-9Initial program 93.9%
*-commutative93.9%
Simplified93.9%
Taylor expanded in t around 0 77.5%
associate-+r+77.5%
mul-1-neg77.5%
unsub-neg77.5%
+-commutative77.5%
associate-/l*82.0%
+-commutative82.0%
Simplified82.0%
Taylor expanded in y around 0 77.3%
mul-1-neg77.3%
sub-neg77.3%
times-frac76.2%
+-commutative76.2%
Simplified76.2%
Final simplification80.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9.2e-125) (not (<= z 1.85e-77))) (/ (+ x (/ y t)) (+ x 1.0)) (- 1.0 (/ y (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.2e-125) || !(z <= 1.85e-77)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - (y / (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 ((z <= (-9.2d-125)) .or. (.not. (z <= 1.85d-77))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 - (y / (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.2e-125) || !(z <= 1.85e-77)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - (y / (x / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9.2e-125) or not (z <= 1.85e-77): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 - (y / (x / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9.2e-125) || !(z <= 1.85e-77)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(y / Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -9.2e-125) || ~((z <= 1.85e-77))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 - (y / (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9.2e-125], N[Not[LessEqual[z, 1.85e-77]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{-125} \lor \neg \left(z \leq 1.85 \cdot 10^{-77}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y}{\frac{x}{z}}\\
\end{array}
\end{array}
if z < -9.1999999999999996e-125 or 1.84999999999999998e-77 < z Initial program 89.0%
*-commutative89.0%
Simplified89.0%
Taylor expanded in z around inf 79.4%
if -9.1999999999999996e-125 < z < 1.84999999999999998e-77Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 74.4%
Taylor expanded in y around inf 75.8%
Taylor expanded in x around 0 79.1%
mul-1-neg79.1%
associate-/l*79.1%
Simplified79.1%
Final simplification79.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.5e-5) (not (<= t 1.2e+99))) (/ x (+ x 1.0)) (- 1.0 (/ y (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.5e-5) || !(t <= 1.2e+99)) {
tmp = x / (x + 1.0);
} else {
tmp = 1.0 - (y / (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 ((t <= (-2.5d-5)) .or. (.not. (t <= 1.2d+99))) then
tmp = x / (x + 1.0d0)
else
tmp = 1.0d0 - (y / (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.5e-5) || !(t <= 1.2e+99)) {
tmp = x / (x + 1.0);
} else {
tmp = 1.0 - (y / (x / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.5e-5) or not (t <= 1.2e+99): tmp = x / (x + 1.0) else: tmp = 1.0 - (y / (x / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.5e-5) || !(t <= 1.2e+99)) tmp = Float64(x / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(y / Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.5e-5) || ~((t <= 1.2e+99))) tmp = x / (x + 1.0); else tmp = 1.0 - (y / (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.5e-5], N[Not[LessEqual[t, 1.2e+99]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{-5} \lor \neg \left(t \leq 1.2 \cdot 10^{+99}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y}{\frac{x}{z}}\\
\end{array}
\end{array}
if t < -2.50000000000000012e-5 or 1.2000000000000001e99 < t Initial program 91.6%
*-commutative91.6%
Simplified91.6%
Taylor expanded in t around inf 75.5%
+-commutative75.5%
Simplified75.5%
if -2.50000000000000012e-5 < t < 1.2000000000000001e99Initial program 94.0%
*-commutative94.0%
Simplified94.0%
Taylor expanded in z around 0 70.0%
Taylor expanded in y around inf 72.5%
Taylor expanded in x around 0 65.1%
mul-1-neg65.1%
associate-/l*65.2%
Simplified65.2%
Final simplification69.5%
(FPCore (x y z t) :precision binary64 (if (<= x -1.8e-27) 1.0 (if (<= x 1.75e-75) (/ y t) (/ x (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.8e-27) {
tmp = 1.0;
} else if (x <= 1.75e-75) {
tmp = y / t;
} else {
tmp = 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 (x <= (-1.8d-27)) then
tmp = 1.0d0
else if (x <= 1.75d-75) then
tmp = y / t
else
tmp = 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 (x <= -1.8e-27) {
tmp = 1.0;
} else if (x <= 1.75e-75) {
tmp = y / t;
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.8e-27: tmp = 1.0 elif x <= 1.75e-75: tmp = y / t else: tmp = x / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.8e-27) tmp = 1.0; elseif (x <= 1.75e-75) tmp = Float64(y / t); else tmp = Float64(x / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.8e-27) tmp = 1.0; elseif (x <= 1.75e-75) tmp = y / t; else tmp = x / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.8e-27], 1.0, If[LessEqual[x, 1.75e-75], N[(y / t), $MachinePrecision], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{-27}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-75}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -1.7999999999999999e-27Initial program 92.8%
*-commutative92.8%
Simplified92.8%
Taylor expanded in t around 0 83.5%
associate-+r+83.5%
mul-1-neg83.5%
unsub-neg83.5%
+-commutative83.5%
associate-/l*89.4%
+-commutative89.4%
Simplified89.4%
Taylor expanded in x around inf 86.5%
if -1.7999999999999999e-27 < x < 1.74999999999999993e-75Initial program 92.0%
*-commutative92.0%
Simplified92.0%
Taylor expanded in y around inf 54.5%
Taylor expanded in z around inf 40.4%
associate-/r*40.4%
+-commutative40.4%
Simplified40.4%
Taylor expanded in x around 0 40.4%
if 1.74999999999999993e-75 < x Initial program 94.6%
*-commutative94.6%
Simplified94.6%
Taylor expanded in t around inf 77.4%
+-commutative77.4%
Simplified77.4%
Final simplification65.9%
(FPCore (x y z t) :precision binary64 (if (<= x -5e-26) 1.0 (if (<= x 5.8e-128) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5e-26) {
tmp = 1.0;
} else if (x <= 5.8e-128) {
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 <= (-5d-26)) then
tmp = 1.0d0
else if (x <= 5.8d-128) 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 <= -5e-26) {
tmp = 1.0;
} else if (x <= 5.8e-128) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5e-26: tmp = 1.0 elif x <= 5.8e-128: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5e-26) tmp = 1.0; elseif (x <= 5.8e-128) 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 <= -5e-26) tmp = 1.0; elseif (x <= 5.8e-128) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5e-26], 1.0, If[LessEqual[x, 5.8e-128], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-26}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-128}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -5.00000000000000019e-26 or 5.8000000000000001e-128 < x Initial program 93.3%
*-commutative93.3%
Simplified93.3%
Taylor expanded in t around 0 81.6%
associate-+r+81.6%
mul-1-neg81.6%
unsub-neg81.6%
+-commutative81.6%
associate-/l*86.3%
+-commutative86.3%
Simplified86.3%
Taylor expanded in x around inf 79.3%
if -5.00000000000000019e-26 < x < 5.8000000000000001e-128Initial program 92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in y around inf 55.8%
Taylor expanded in z around inf 41.4%
associate-/r*41.4%
+-commutative41.4%
Simplified41.4%
Taylor expanded in x around 0 41.4%
Final simplification65.7%
(FPCore (x y z t) :precision binary64 (if (<= x -3.8e-48) 1.0 (if (<= x 3.3e-69) x 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.8e-48) {
tmp = 1.0;
} else if (x <= 3.3e-69) {
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 <= (-3.8d-48)) then
tmp = 1.0d0
else if (x <= 3.3d-69) 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 <= -3.8e-48) {
tmp = 1.0;
} else if (x <= 3.3e-69) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.8e-48: tmp = 1.0 elif x <= 3.3e-69: tmp = x else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.8e-48) tmp = 1.0; elseif (x <= 3.3e-69) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.8e-48) tmp = 1.0; elseif (x <= 3.3e-69) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.8e-48], 1.0, If[LessEqual[x, 3.3e-69], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{-48}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{-69}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -3.80000000000000002e-48 or 3.3e-69 < x Initial program 93.7%
*-commutative93.7%
Simplified93.7%
Taylor expanded in t around 0 83.2%
associate-+r+83.2%
mul-1-neg83.2%
unsub-neg83.2%
+-commutative83.2%
associate-/l*88.2%
+-commutative88.2%
Simplified88.2%
Taylor expanded in x around inf 81.4%
if -3.80000000000000002e-48 < x < 3.3e-69Initial program 91.9%
*-commutative91.9%
Simplified91.9%
Taylor expanded in t around inf 61.9%
Taylor expanded in y around 0 33.4%
+-commutative33.4%
Simplified33.4%
Taylor expanded in x around 0 33.4%
distribute-lft-out--33.4%
*-rgt-identity33.4%
*-commutative33.4%
associate-*r/33.4%
*-rgt-identity33.4%
Simplified33.4%
Taylor expanded in z around inf 23.8%
Final simplification59.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 93.0%
*-commutative93.0%
Simplified93.0%
Taylor expanded in t around 0 65.4%
associate-+r+65.4%
mul-1-neg65.4%
unsub-neg65.4%
+-commutative65.4%
associate-/l*68.5%
+-commutative68.5%
Simplified68.5%
Taylor expanded in x around inf 54.9%
Final simplification54.9%
(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 2024026
(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)))