
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.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) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.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) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
(FPCore (x y z t) :precision binary64 (/ (- y (- z x)) (* 2.0 t)))
double code(double x, double y, double z, double t) {
return (y - (z - x)) / (2.0 * t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (y - (z - x)) / (2.0d0 * t)
end function
public static double code(double x, double y, double z, double t) {
return (y - (z - x)) / (2.0 * t);
}
def code(x, y, z, t): return (y - (z - x)) / (2.0 * t)
function code(x, y, z, t) return Float64(Float64(y - Float64(z - x)) / Float64(2.0 * t)) end
function tmp = code(x, y, z, t) tmp = (y - (z - x)) / (2.0 * t); end
code[x_, y_, z_, t_] := N[(N[(y - N[(z - x), $MachinePrecision]), $MachinePrecision] / N[(2.0 * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y - \left(z - x\right)}{2 \cdot t}
\end{array}
Initial program 100.0%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
lower--.f64100.0
Applied rewrites100.0%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -1e+77) (/ (* 0.5 x) t) (if (<= (+ x y) 2e-27) (/ (* -0.5 z) t) (/ (* 0.5 y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e+77) {
tmp = (0.5 * x) / t;
} else if ((x + y) <= 2e-27) {
tmp = (-0.5 * z) / t;
} else {
tmp = (0.5 * 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 + y) <= (-1d+77)) then
tmp = (0.5d0 * x) / t
else if ((x + y) <= 2d-27) then
tmp = ((-0.5d0) * z) / t
else
tmp = (0.5d0 * y) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e+77) {
tmp = (0.5 * x) / t;
} else if ((x + y) <= 2e-27) {
tmp = (-0.5 * z) / t;
} else {
tmp = (0.5 * y) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -1e+77: tmp = (0.5 * x) / t elif (x + y) <= 2e-27: tmp = (-0.5 * z) / t else: tmp = (0.5 * y) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -1e+77) tmp = Float64(Float64(0.5 * x) / t); elseif (Float64(x + y) <= 2e-27) tmp = Float64(Float64(-0.5 * z) / t); else tmp = Float64(Float64(0.5 * y) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -1e+77) tmp = (0.5 * x) / t; elseif ((x + y) <= 2e-27) tmp = (-0.5 * z) / t; else tmp = (0.5 * y) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e+77], N[(N[(0.5 * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 2e-27], N[(N[(-0.5 * z), $MachinePrecision] / t), $MachinePrecision], N[(N[(0.5 * y), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{+77}:\\
\;\;\;\;\frac{0.5 \cdot x}{t}\\
\mathbf{elif}\;x + y \leq 2 \cdot 10^{-27}:\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot y}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < -9.99999999999999983e76Initial program 100.0%
Taylor expanded in x around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6442.4
Applied rewrites42.4%
Applied rewrites42.6%
if -9.99999999999999983e76 < (+.f64 x y) < 2.0000000000000001e-27Initial program 100.0%
Taylor expanded in z around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6469.3
Applied rewrites69.3%
Applied rewrites69.5%
if 2.0000000000000001e-27 < (+.f64 x y) Initial program 100.0%
Taylor expanded in y around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6441.1
Applied rewrites41.1%
Applied rewrites41.2%
Final simplification49.8%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -1e+77) (* (/ 0.5 t) x) (if (<= (+ x y) 2e-27) (/ (* -0.5 z) t) (/ (* 0.5 y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e+77) {
tmp = (0.5 / t) * x;
} else if ((x + y) <= 2e-27) {
tmp = (-0.5 * z) / t;
} else {
tmp = (0.5 * 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 + y) <= (-1d+77)) then
tmp = (0.5d0 / t) * x
else if ((x + y) <= 2d-27) then
tmp = ((-0.5d0) * z) / t
else
tmp = (0.5d0 * y) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e+77) {
tmp = (0.5 / t) * x;
} else if ((x + y) <= 2e-27) {
tmp = (-0.5 * z) / t;
} else {
tmp = (0.5 * y) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -1e+77: tmp = (0.5 / t) * x elif (x + y) <= 2e-27: tmp = (-0.5 * z) / t else: tmp = (0.5 * y) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -1e+77) tmp = Float64(Float64(0.5 / t) * x); elseif (Float64(x + y) <= 2e-27) tmp = Float64(Float64(-0.5 * z) / t); else tmp = Float64(Float64(0.5 * y) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -1e+77) tmp = (0.5 / t) * x; elseif ((x + y) <= 2e-27) tmp = (-0.5 * z) / t; else tmp = (0.5 * y) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e+77], N[(N[(0.5 / t), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 2e-27], N[(N[(-0.5 * z), $MachinePrecision] / t), $MachinePrecision], N[(N[(0.5 * y), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{+77}:\\
\;\;\;\;\frac{0.5}{t} \cdot x\\
\mathbf{elif}\;x + y \leq 2 \cdot 10^{-27}:\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot y}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < -9.99999999999999983e76Initial program 100.0%
Taylor expanded in x around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6442.4
Applied rewrites42.4%
if -9.99999999999999983e76 < (+.f64 x y) < 2.0000000000000001e-27Initial program 100.0%
Taylor expanded in z around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6469.3
Applied rewrites69.3%
Applied rewrites69.5%
if 2.0000000000000001e-27 < (+.f64 x y) Initial program 100.0%
Taylor expanded in y around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6441.1
Applied rewrites41.1%
Applied rewrites41.2%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -1e+77) (* (/ 0.5 t) x) (if (<= (+ x y) 2e-27) (/ (* -0.5 z) t) (* (/ 0.5 t) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e+77) {
tmp = (0.5 / t) * x;
} else if ((x + y) <= 2e-27) {
tmp = (-0.5 * z) / t;
} else {
tmp = (0.5 / t) * y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x + y) <= (-1d+77)) then
tmp = (0.5d0 / t) * x
else if ((x + y) <= 2d-27) then
tmp = ((-0.5d0) * z) / t
else
tmp = (0.5d0 / t) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e+77) {
tmp = (0.5 / t) * x;
} else if ((x + y) <= 2e-27) {
tmp = (-0.5 * z) / t;
} else {
tmp = (0.5 / t) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -1e+77: tmp = (0.5 / t) * x elif (x + y) <= 2e-27: tmp = (-0.5 * z) / t else: tmp = (0.5 / t) * y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -1e+77) tmp = Float64(Float64(0.5 / t) * x); elseif (Float64(x + y) <= 2e-27) tmp = Float64(Float64(-0.5 * z) / t); else tmp = Float64(Float64(0.5 / t) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -1e+77) tmp = (0.5 / t) * x; elseif ((x + y) <= 2e-27) tmp = (-0.5 * z) / t; else tmp = (0.5 / t) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e+77], N[(N[(0.5 / t), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 2e-27], N[(N[(-0.5 * z), $MachinePrecision] / t), $MachinePrecision], N[(N[(0.5 / t), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{+77}:\\
\;\;\;\;\frac{0.5}{t} \cdot x\\
\mathbf{elif}\;x + y \leq 2 \cdot 10^{-27}:\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot y\\
\end{array}
\end{array}
if (+.f64 x y) < -9.99999999999999983e76Initial program 100.0%
Taylor expanded in x around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6442.4
Applied rewrites42.4%
if -9.99999999999999983e76 < (+.f64 x y) < 2.0000000000000001e-27Initial program 100.0%
Taylor expanded in z around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6469.3
Applied rewrites69.3%
Applied rewrites69.5%
if 2.0000000000000001e-27 < (+.f64 x y) Initial program 100.0%
Taylor expanded in y around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6441.1
Applied rewrites41.1%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -1e+77) (* (/ 0.5 t) x) (if (<= (+ x y) 2e-27) (* (/ -0.5 t) z) (* (/ 0.5 t) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e+77) {
tmp = (0.5 / t) * x;
} else if ((x + y) <= 2e-27) {
tmp = (-0.5 / t) * z;
} else {
tmp = (0.5 / t) * y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x + y) <= (-1d+77)) then
tmp = (0.5d0 / t) * x
else if ((x + y) <= 2d-27) then
tmp = ((-0.5d0) / t) * z
else
tmp = (0.5d0 / t) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e+77) {
tmp = (0.5 / t) * x;
} else if ((x + y) <= 2e-27) {
tmp = (-0.5 / t) * z;
} else {
tmp = (0.5 / t) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -1e+77: tmp = (0.5 / t) * x elif (x + y) <= 2e-27: tmp = (-0.5 / t) * z else: tmp = (0.5 / t) * y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -1e+77) tmp = Float64(Float64(0.5 / t) * x); elseif (Float64(x + y) <= 2e-27) tmp = Float64(Float64(-0.5 / t) * z); else tmp = Float64(Float64(0.5 / t) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -1e+77) tmp = (0.5 / t) * x; elseif ((x + y) <= 2e-27) tmp = (-0.5 / t) * z; else tmp = (0.5 / t) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e+77], N[(N[(0.5 / t), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 2e-27], N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision], N[(N[(0.5 / t), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{+77}:\\
\;\;\;\;\frac{0.5}{t} \cdot x\\
\mathbf{elif}\;x + y \leq 2 \cdot 10^{-27}:\\
\;\;\;\;\frac{-0.5}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot y\\
\end{array}
\end{array}
if (+.f64 x y) < -9.99999999999999983e76Initial program 100.0%
Taylor expanded in x around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6442.4
Applied rewrites42.4%
if -9.99999999999999983e76 < (+.f64 x y) < 2.0000000000000001e-27Initial program 100.0%
Taylor expanded in z around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6469.3
Applied rewrites69.3%
if 2.0000000000000001e-27 < (+.f64 x y) Initial program 100.0%
Taylor expanded in y around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6441.1
Applied rewrites41.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ (- x z) (* 2.0 t)))) (if (<= z -1.3e+61) t_1 (if (<= z 9e+79) (/ (+ x y) (* 2.0 t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x - z) / (2.0 * t);
double tmp;
if (z <= -1.3e+61) {
tmp = t_1;
} else if (z <= 9e+79) {
tmp = (x + y) / (2.0 * t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x - z) / (2.0d0 * t)
if (z <= (-1.3d+61)) then
tmp = t_1
else if (z <= 9d+79) then
tmp = (x + y) / (2.0d0 * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - z) / (2.0 * t);
double tmp;
if (z <= -1.3e+61) {
tmp = t_1;
} else if (z <= 9e+79) {
tmp = (x + y) / (2.0 * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - z) / (2.0 * t) tmp = 0 if z <= -1.3e+61: tmp = t_1 elif z <= 9e+79: tmp = (x + y) / (2.0 * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - z) / Float64(2.0 * t)) tmp = 0.0 if (z <= -1.3e+61) tmp = t_1; elseif (z <= 9e+79) tmp = Float64(Float64(x + y) / Float64(2.0 * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - z) / (2.0 * t); tmp = 0.0; if (z <= -1.3e+61) tmp = t_1; elseif (z <= 9e+79) tmp = (x + y) / (2.0 * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - z), $MachinePrecision] / N[(2.0 * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.3e+61], t$95$1, If[LessEqual[z, 9e+79], N[(N[(x + y), $MachinePrecision] / N[(2.0 * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - z}{2 \cdot t}\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+79}:\\
\;\;\;\;\frac{x + y}{2 \cdot t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.29999999999999986e61 or 8.99999999999999987e79 < z Initial program 100.0%
Taylor expanded in y around 0
lower--.f6486.2
Applied rewrites86.2%
if -1.29999999999999986e61 < z < 8.99999999999999987e79Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6491.2
Applied rewrites91.2%
Final simplification89.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- x z) (/ 0.5 t)))) (if (<= z -1.3e+61) t_1 (if (<= z 9e+79) (/ (+ x y) (* 2.0 t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x - z) * (0.5 / t);
double tmp;
if (z <= -1.3e+61) {
tmp = t_1;
} else if (z <= 9e+79) {
tmp = (x + y) / (2.0 * t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x - z) * (0.5d0 / t)
if (z <= (-1.3d+61)) then
tmp = t_1
else if (z <= 9d+79) then
tmp = (x + y) / (2.0d0 * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - z) * (0.5 / t);
double tmp;
if (z <= -1.3e+61) {
tmp = t_1;
} else if (z <= 9e+79) {
tmp = (x + y) / (2.0 * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - z) * (0.5 / t) tmp = 0 if z <= -1.3e+61: tmp = t_1 elif z <= 9e+79: tmp = (x + y) / (2.0 * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - z) * Float64(0.5 / t)) tmp = 0.0 if (z <= -1.3e+61) tmp = t_1; elseif (z <= 9e+79) tmp = Float64(Float64(x + y) / Float64(2.0 * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - z) * (0.5 / t); tmp = 0.0; if (z <= -1.3e+61) tmp = t_1; elseif (z <= 9e+79) tmp = (x + y) / (2.0 * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.3e+61], t$95$1, If[LessEqual[z, 9e+79], N[(N[(x + y), $MachinePrecision] / N[(2.0 * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x - z\right) \cdot \frac{0.5}{t}\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+79}:\\
\;\;\;\;\frac{x + y}{2 \cdot t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.29999999999999986e61 or 8.99999999999999987e79 < z Initial program 100.0%
Taylor expanded in y around 0
lower--.f6486.2
Applied rewrites86.2%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f6486.0
Applied rewrites86.0%
if -1.29999999999999986e61 < z < 8.99999999999999987e79Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6491.2
Applied rewrites91.2%
Final simplification89.0%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -5e-232) (/ (- x z) (* 2.0 t)) (/ (- y z) (* 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-232) {
tmp = (x - z) / (2.0 * t);
} else {
tmp = (y - z) / (2.0 * 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 + y) <= (-5d-232)) then
tmp = (x - z) / (2.0d0 * t)
else
tmp = (y - z) / (2.0d0 * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-232) {
tmp = (x - z) / (2.0 * t);
} else {
tmp = (y - z) / (2.0 * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -5e-232: tmp = (x - z) / (2.0 * t) else: tmp = (y - z) / (2.0 * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -5e-232) tmp = Float64(Float64(x - z) / Float64(2.0 * t)); else tmp = Float64(Float64(y - z) / Float64(2.0 * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -5e-232) tmp = (x - z) / (2.0 * t); else tmp = (y - z) / (2.0 * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -5e-232], N[(N[(x - z), $MachinePrecision] / N[(2.0 * t), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] / N[(2.0 * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -5 \cdot 10^{-232}:\\
\;\;\;\;\frac{x - z}{2 \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{2 \cdot t}\\
\end{array}
\end{array}
if (+.f64 x y) < -4.9999999999999999e-232Initial program 100.0%
Taylor expanded in y around 0
lower--.f6469.1
Applied rewrites69.1%
if -4.9999999999999999e-232 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0
lower--.f6471.4
Applied rewrites71.4%
Final simplification70.4%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) 2e-27) (* (- x z) (/ 0.5 t)) (/ (* 0.5 y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 2e-27) {
tmp = (x - z) * (0.5 / t);
} else {
tmp = (0.5 * 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 + y) <= 2d-27) then
tmp = (x - z) * (0.5d0 / t)
else
tmp = (0.5d0 * y) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 2e-27) {
tmp = (x - z) * (0.5 / t);
} else {
tmp = (0.5 * y) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= 2e-27: tmp = (x - z) * (0.5 / t) else: tmp = (0.5 * y) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= 2e-27) tmp = Float64(Float64(x - z) * Float64(0.5 / t)); else tmp = Float64(Float64(0.5 * y) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= 2e-27) tmp = (x - z) * (0.5 / t); else tmp = (0.5 * y) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], 2e-27], N[(N[(x - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * y), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 2 \cdot 10^{-27}:\\
\;\;\;\;\left(x - z\right) \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot y}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < 2.0000000000000001e-27Initial program 100.0%
Taylor expanded in y around 0
lower--.f6472.2
Applied rewrites72.2%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f6472.0
Applied rewrites72.0%
if 2.0000000000000001e-27 < (+.f64 x y) Initial program 100.0%
Taylor expanded in y around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6441.1
Applied rewrites41.1%
Applied rewrites41.2%
Final simplification57.8%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -1e+77) (* (/ 0.5 t) x) (* (/ -0.5 t) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e+77) {
tmp = (0.5 / t) * x;
} else {
tmp = (-0.5 / t) * z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x + y) <= (-1d+77)) then
tmp = (0.5d0 / t) * x
else
tmp = ((-0.5d0) / t) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e+77) {
tmp = (0.5 / t) * x;
} else {
tmp = (-0.5 / t) * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -1e+77: tmp = (0.5 / t) * x else: tmp = (-0.5 / t) * z return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -1e+77) tmp = Float64(Float64(0.5 / t) * x); else tmp = Float64(Float64(-0.5 / t) * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -1e+77) tmp = (0.5 / t) * x; else tmp = (-0.5 / t) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e+77], N[(N[(0.5 / t), $MachinePrecision] * x), $MachinePrecision], N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{+77}:\\
\;\;\;\;\frac{0.5}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{t} \cdot z\\
\end{array}
\end{array}
if (+.f64 x y) < -9.99999999999999983e76Initial program 100.0%
Taylor expanded in x around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6442.4
Applied rewrites42.4%
if -9.99999999999999983e76 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6444.6
Applied rewrites44.6%
(FPCore (x y z t) :precision binary64 (* (- (+ x y) z) (/ 0.5 t)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) * (0.5 / t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) * (0.5d0 / t)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) * (0.5 / t);
}
def code(x, y, z, t): return ((x + y) - z) * (0.5 / t)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) * Float64(0.5 / t)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) * (0.5 / t); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y\right) - z\right) \cdot \frac{0.5}{t}
\end{array}
Initial program 100.0%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-eval99.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (* (/ -0.5 t) z))
double code(double x, double y, double z, double t) {
return (-0.5 / t) * z;
}
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 = ((-0.5d0) / t) * z
end function
public static double code(double x, double y, double z, double t) {
return (-0.5 / t) * z;
}
def code(x, y, z, t): return (-0.5 / t) * z
function code(x, y, z, t) return Float64(Float64(-0.5 / t) * z) end
function tmp = code(x, y, z, t) tmp = (-0.5 / t) * z; end
code[x_, y_, z_, t_] := N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision]
\begin{array}{l}
\\
\frac{-0.5}{t} \cdot z
\end{array}
Initial program 100.0%
Taylor expanded in z around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6438.0
Applied rewrites38.0%
herbie shell --seed 2024250
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, B"
:precision binary64
(/ (- (+ x y) z) (* t 2.0)))