
(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
(let* ((t_1 (- (* z t) x)) (t_2 (/ (+ x (/ (- (* y z) x) t_1)) (+ x 1.0))))
(if (<= t_2 -1e+54)
(* (/ y (+ x 1.0)) (/ z t_1))
(if (<= t_2 5e+283) t_2 (/ (+ x (/ y t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -1e+54) {
tmp = (y / (x + 1.0)) * (z / t_1);
} else if (t_2 <= 5e+283) {
tmp = t_2;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z * t) - x
t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0d0)
if (t_2 <= (-1d+54)) then
tmp = (y / (x + 1.0d0)) * (z / t_1)
else if (t_2 <= 5d+283) then
tmp = t_2
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 t_1 = (z * t) - x;
double t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -1e+54) {
tmp = (y / (x + 1.0)) * (z / t_1);
} else if (t_2 <= 5e+283) {
tmp = t_2;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0) tmp = 0 if t_2 <= -1e+54: tmp = (y / (x + 1.0)) * (z / t_1) elif t_2 <= 5e+283: tmp = t_2 else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) t_2 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / t_1)) / Float64(x + 1.0)) tmp = 0.0 if (t_2 <= -1e+54) tmp = Float64(Float64(y / Float64(x + 1.0)) * Float64(z / t_1)); elseif (t_2 <= 5e+283) tmp = t_2; 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 = (z * t) - x; t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0); tmp = 0.0; if (t_2 <= -1e+54) tmp = (y / (x + 1.0)) * (z / t_1); elseif (t_2 <= 5e+283) tmp = t_2; else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+54], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+283], t$95$2, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \frac{x + \frac{y \cdot z - x}{t_1}}{x + 1}\\
\mathbf{if}\;t_2 \leq -1 \cdot 10^{+54}:\\
\;\;\;\;\frac{y}{x + 1} \cdot \frac{z}{t_1}\\
\mathbf{elif}\;t_2 \leq 5 \cdot 10^{+283}:\\
\;\;\;\;t_2\\
\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)) < -1.0000000000000001e54Initial program 78.5%
*-commutative78.5%
Simplified78.5%
Taylor expanded in y around inf 78.3%
*-commutative78.3%
*-commutative78.3%
times-frac96.7%
+-commutative96.7%
*-commutative96.7%
Simplified96.7%
if -1.0000000000000001e54 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 5.0000000000000004e283Initial program 99.0%
if 5.0000000000000004e283 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 17.1%
*-commutative17.1%
Simplified17.1%
Taylor expanded in z around inf 96.2%
Final simplification98.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.6e-100) (not (<= t 3.4e-142))) (/ (+ x (/ y t)) (+ x 1.0)) (- 1.0 (* (/ y (+ x 1.0)) (/ z x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.6e-100) || !(t <= 3.4e-142)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y / (x + 1.0)) * (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 <= (-1.6d-100)) .or. (.not. (t <= 3.4d-142))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 - ((y / (x + 1.0d0)) * (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.6e-100) || !(t <= 3.4e-142)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y / (x + 1.0)) * (z / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.6e-100) or not (t <= 3.4e-142): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 - ((y / (x + 1.0)) * (z / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.6e-100) || !(t <= 3.4e-142)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(Float64(y / Float64(x + 1.0)) * Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.6e-100) || ~((t <= 3.4e-142))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 - ((y / (x + 1.0)) * (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.6e-100], N[Not[LessEqual[t, 3.4e-142]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{-100} \lor \neg \left(t \leq 3.4 \cdot 10^{-142}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y}{x + 1} \cdot \frac{z}{x}\\
\end{array}
\end{array}
if t < -1.60000000000000008e-100 or 3.40000000000000029e-142 < t Initial program 84.5%
*-commutative84.5%
Simplified84.5%
Taylor expanded in z around inf 85.5%
if -1.60000000000000008e-100 < t < 3.40000000000000029e-142Initial program 95.3%
*-commutative95.3%
Simplified95.3%
Taylor expanded in t around 0 80.2%
+-commutative80.2%
+-commutative80.2%
associate-+l+80.2%
+-commutative80.2%
mul-1-neg80.2%
unsub-neg80.2%
associate-/l*84.6%
+-commutative84.6%
Simplified84.6%
Taylor expanded in y around 0 80.2%
mul-1-neg80.2%
unsub-neg80.2%
*-commutative80.2%
+-commutative80.2%
*-commutative80.2%
times-frac84.6%
Simplified84.6%
Final simplification85.2%
(FPCore (x y z t) :precision binary64 (if (<= x -1.65e-30) 1.0 (if (<= x 9.2e-96) (/ y t) (if (<= x 2.1e+23) (- 1.0 (* y (/ z x))) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.65e-30) {
tmp = 1.0;
} else if (x <= 9.2e-96) {
tmp = y / t;
} else if (x <= 2.1e+23) {
tmp = 1.0 - (y * (z / 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 <= (-1.65d-30)) then
tmp = 1.0d0
else if (x <= 9.2d-96) then
tmp = y / t
else if (x <= 2.1d+23) then
tmp = 1.0d0 - (y * (z / 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 <= -1.65e-30) {
tmp = 1.0;
} else if (x <= 9.2e-96) {
tmp = y / t;
} else if (x <= 2.1e+23) {
tmp = 1.0 - (y * (z / x));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.65e-30: tmp = 1.0 elif x <= 9.2e-96: tmp = y / t elif x <= 2.1e+23: tmp = 1.0 - (y * (z / x)) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.65e-30) tmp = 1.0; elseif (x <= 9.2e-96) tmp = Float64(y / t); elseif (x <= 2.1e+23) tmp = Float64(1.0 - Float64(y * Float64(z / x))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.65e-30) tmp = 1.0; elseif (x <= 9.2e-96) tmp = y / t; elseif (x <= 2.1e+23) tmp = 1.0 - (y * (z / x)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.65e-30], 1.0, If[LessEqual[x, 9.2e-96], N[(y / t), $MachinePrecision], If[LessEqual[x, 2.1e+23], N[(1.0 - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{-30}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{-96}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{+23}:\\
\;\;\;\;1 - y \cdot \frac{z}{x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.6500000000000001e-30 or 2.1000000000000001e23 < x Initial program 89.3%
*-commutative89.3%
Simplified89.3%
Taylor expanded in y around 0 90.4%
+-commutative90.4%
Simplified90.4%
Taylor expanded in x around inf 89.6%
if -1.6500000000000001e-30 < x < 9.2e-96Initial program 85.5%
*-commutative85.5%
Simplified85.5%
Taylor expanded in y around inf 57.2%
times-frac55.6%
+-commutative55.6%
Simplified55.6%
Taylor expanded in x around 0 55.6%
Taylor expanded in t around inf 59.7%
if 9.2e-96 < x < 2.1000000000000001e23Initial program 92.6%
*-commutative92.6%
Simplified92.6%
Taylor expanded in t around 0 70.7%
+-commutative70.7%
+-commutative70.7%
associate-+l+70.7%
+-commutative70.7%
mul-1-neg70.7%
unsub-neg70.7%
associate-/l*70.5%
+-commutative70.5%
Simplified70.5%
Taylor expanded in y around 0 70.7%
mul-1-neg70.7%
unsub-neg70.7%
*-commutative70.7%
+-commutative70.7%
*-commutative70.7%
times-frac70.4%
Simplified70.4%
Taylor expanded in x around 0 65.5%
Final simplification75.2%
(FPCore (x y z t) :precision binary64 (if (<= x -2.4e-29) (- 1.0 (* y (/ z (* x x)))) (if (<= x 7.5e-95) (/ y t) (if (<= x 4e+18) (- 1.0 (* y (/ z x))) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.4e-29) {
tmp = 1.0 - (y * (z / (x * x)));
} else if (x <= 7.5e-95) {
tmp = y / t;
} else if (x <= 4e+18) {
tmp = 1.0 - (y * (z / 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 <= (-2.4d-29)) then
tmp = 1.0d0 - (y * (z / (x * x)))
else if (x <= 7.5d-95) then
tmp = y / t
else if (x <= 4d+18) then
tmp = 1.0d0 - (y * (z / 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 <= -2.4e-29) {
tmp = 1.0 - (y * (z / (x * x)));
} else if (x <= 7.5e-95) {
tmp = y / t;
} else if (x <= 4e+18) {
tmp = 1.0 - (y * (z / x));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.4e-29: tmp = 1.0 - (y * (z / (x * x))) elif x <= 7.5e-95: tmp = y / t elif x <= 4e+18: tmp = 1.0 - (y * (z / x)) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.4e-29) tmp = Float64(1.0 - Float64(y * Float64(z / Float64(x * x)))); elseif (x <= 7.5e-95) tmp = Float64(y / t); elseif (x <= 4e+18) tmp = Float64(1.0 - Float64(y * Float64(z / x))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.4e-29) tmp = 1.0 - (y * (z / (x * x))); elseif (x <= 7.5e-95) tmp = y / t; elseif (x <= 4e+18) tmp = 1.0 - (y * (z / x)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.4e-29], N[(1.0 - N[(y * N[(z / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.5e-95], N[(y / t), $MachinePrecision], If[LessEqual[x, 4e+18], N[(1.0 - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{-29}:\\
\;\;\;\;1 - y \cdot \frac{z}{x \cdot x}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-95}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+18}:\\
\;\;\;\;1 - y \cdot \frac{z}{x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.39999999999999992e-29Initial program 88.9%
*-commutative88.9%
Simplified88.9%
Taylor expanded in t around 0 84.1%
+-commutative84.1%
+-commutative84.1%
associate-+l+84.1%
+-commutative84.1%
mul-1-neg84.1%
unsub-neg84.1%
associate-/l*88.9%
+-commutative88.9%
Simplified88.9%
Taylor expanded in x around inf 79.3%
mul-1-neg79.3%
unpow279.3%
associate-*r/85.7%
unsub-neg85.7%
Simplified85.7%
if -2.39999999999999992e-29 < x < 7.5000000000000003e-95Initial program 85.5%
*-commutative85.5%
Simplified85.5%
Taylor expanded in y around inf 57.2%
times-frac55.6%
+-commutative55.6%
Simplified55.6%
Taylor expanded in x around 0 55.6%
Taylor expanded in t around inf 59.7%
if 7.5000000000000003e-95 < x < 4e18Initial program 92.6%
*-commutative92.6%
Simplified92.6%
Taylor expanded in t around 0 70.7%
+-commutative70.7%
+-commutative70.7%
associate-+l+70.7%
+-commutative70.7%
mul-1-neg70.7%
unsub-neg70.7%
associate-/l*70.5%
+-commutative70.5%
Simplified70.5%
Taylor expanded in y around 0 70.7%
mul-1-neg70.7%
unsub-neg70.7%
*-commutative70.7%
+-commutative70.7%
*-commutative70.7%
times-frac70.4%
Simplified70.4%
Taylor expanded in x around 0 65.5%
if 4e18 < x Initial program 89.6%
*-commutative89.6%
Simplified89.6%
Taylor expanded in y around 0 97.0%
+-commutative97.0%
Simplified97.0%
Taylor expanded in x around inf 97.0%
Final simplification76.2%
(FPCore (x y z t)
:precision binary64
(if (<= x -7.5e-16)
(- 1.0 (* y (/ z (* x x))))
(if (<= x 2.2e-80)
(/ (+ x (/ y t)) (+ x 1.0))
(if (<= x 4e+18) (- 1.0 (* y (/ z x))) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.5e-16) {
tmp = 1.0 - (y * (z / (x * x)));
} else if (x <= 2.2e-80) {
tmp = (x + (y / t)) / (x + 1.0);
} else if (x <= 4e+18) {
tmp = 1.0 - (y * (z / 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.5d-16)) then
tmp = 1.0d0 - (y * (z / (x * x)))
else if (x <= 2.2d-80) then
tmp = (x + (y / t)) / (x + 1.0d0)
else if (x <= 4d+18) then
tmp = 1.0d0 - (y * (z / 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.5e-16) {
tmp = 1.0 - (y * (z / (x * x)));
} else if (x <= 2.2e-80) {
tmp = (x + (y / t)) / (x + 1.0);
} else if (x <= 4e+18) {
tmp = 1.0 - (y * (z / x));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7.5e-16: tmp = 1.0 - (y * (z / (x * x))) elif x <= 2.2e-80: tmp = (x + (y / t)) / (x + 1.0) elif x <= 4e+18: tmp = 1.0 - (y * (z / x)) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7.5e-16) tmp = Float64(1.0 - Float64(y * Float64(z / Float64(x * x)))); elseif (x <= 2.2e-80) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); elseif (x <= 4e+18) tmp = Float64(1.0 - Float64(y * Float64(z / x))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7.5e-16) tmp = 1.0 - (y * (z / (x * x))); elseif (x <= 2.2e-80) tmp = (x + (y / t)) / (x + 1.0); elseif (x <= 4e+18) tmp = 1.0 - (y * (z / x)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7.5e-16], N[(1.0 - N[(y * N[(z / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.2e-80], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4e+18], N[(1.0 - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{-16}:\\
\;\;\;\;1 - y \cdot \frac{z}{x \cdot x}\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-80}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+18}:\\
\;\;\;\;1 - y \cdot \frac{z}{x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -7.5e-16Initial program 88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in t around 0 84.7%
+-commutative84.7%
+-commutative84.7%
associate-+l+84.7%
+-commutative84.7%
mul-1-neg84.7%
unsub-neg84.7%
associate-/l*89.8%
+-commutative89.8%
Simplified89.8%
Taylor expanded in x around inf 83.0%
mul-1-neg83.0%
unpow283.0%
associate-*r/89.8%
unsub-neg89.8%
Simplified89.8%
if -7.5e-16 < x < 2.2000000000000001e-80Initial program 86.6%
*-commutative86.6%
Simplified86.6%
Taylor expanded in z around inf 75.5%
if 2.2000000000000001e-80 < x < 4e18Initial program 91.2%
*-commutative91.2%
Simplified91.2%
Taylor expanded in t around 0 78.3%
+-commutative78.3%
+-commutative78.3%
associate-+l+78.3%
+-commutative78.3%
mul-1-neg78.3%
unsub-neg78.3%
associate-/l*78.2%
+-commutative78.2%
Simplified78.2%
Taylor expanded in y around 0 78.3%
mul-1-neg78.3%
unsub-neg78.3%
*-commutative78.3%
+-commutative78.3%
*-commutative78.3%
times-frac78.2%
Simplified78.2%
Taylor expanded in x around 0 72.4%
if 4e18 < x Initial program 89.6%
*-commutative89.6%
Simplified89.6%
Taylor expanded in y around 0 97.0%
+-commutative97.0%
Simplified97.0%
Taylor expanded in x around inf 97.0%
Final simplification84.0%
(FPCore (x y z t) :precision binary64 (if (<= x -8e-31) 1.0 (if (<= x 5.5e-93) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -8e-31) {
tmp = 1.0;
} else if (x <= 5.5e-93) {
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 <= (-8d-31)) then
tmp = 1.0d0
else if (x <= 5.5d-93) 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 <= -8e-31) {
tmp = 1.0;
} else if (x <= 5.5e-93) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -8e-31: tmp = 1.0 elif x <= 5.5e-93: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -8e-31) tmp = 1.0; elseif (x <= 5.5e-93) 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 <= -8e-31) tmp = 1.0; elseif (x <= 5.5e-93) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -8e-31], 1.0, If[LessEqual[x, 5.5e-93], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8 \cdot 10^{-31}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-93}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -8.000000000000001e-31 or 5.49999999999999968e-93 < x Initial program 89.8%
*-commutative89.8%
Simplified89.8%
Taylor expanded in y around 0 84.2%
+-commutative84.2%
Simplified84.2%
Taylor expanded in x around inf 81.3%
if -8.000000000000001e-31 < x < 5.49999999999999968e-93Initial program 85.7%
*-commutative85.7%
Simplified85.7%
Taylor expanded in y around inf 57.6%
times-frac56.0%
+-commutative56.0%
Simplified56.0%
Taylor expanded in x around 0 56.0%
Taylor expanded in t around inf 59.1%
Final simplification72.4%
(FPCore (x y z t) :precision binary64 (if (<= x -7.2e-22) 1.0 (if (<= x 2.6e-78) x 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.2e-22) {
tmp = 1.0;
} else if (x <= 2.6e-78) {
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.2d-22)) then
tmp = 1.0d0
else if (x <= 2.6d-78) 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.2e-22) {
tmp = 1.0;
} else if (x <= 2.6e-78) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7.2e-22: tmp = 1.0 elif x <= 2.6e-78: tmp = x else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7.2e-22) tmp = 1.0; elseif (x <= 2.6e-78) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7.2e-22) tmp = 1.0; elseif (x <= 2.6e-78) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7.2e-22], 1.0, If[LessEqual[x, 2.6e-78], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-22}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-78}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -7.1999999999999996e-22 or 2.6000000000000001e-78 < x Initial program 89.3%
*-commutative89.3%
Simplified89.3%
Taylor expanded in y around 0 84.5%
+-commutative84.5%
Simplified84.5%
Taylor expanded in x around inf 83.8%
if -7.1999999999999996e-22 < x < 2.6000000000000001e-78Initial program 86.5%
*-commutative86.5%
Simplified86.5%
Taylor expanded in t around inf 20.7%
+-commutative20.7%
Simplified20.7%
Taylor expanded in x around 0 20.7%
Final simplification56.9%
(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.1%
*-commutative88.1%
Simplified88.1%
Taylor expanded in y around 0 62.5%
+-commutative62.5%
Simplified62.5%
Taylor expanded in x around inf 52.2%
Final simplification52.2%
(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 2023268
(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)))