
(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 11 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}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= (+ x y) -2e-208) (* (/ (- x z) t) 0.5) (/ (- y z) (* 2.0 t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -2e-208) {
tmp = ((x - z) / t) * 0.5;
} else {
tmp = (y - z) / (2.0 * t);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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-208)) then
tmp = ((x - z) / t) * 0.5d0
else
tmp = (y - z) / (2.0d0 * t)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -2e-208) {
tmp = ((x - z) / t) * 0.5;
} else {
tmp = (y - z) / (2.0 * t);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (x + y) <= -2e-208: tmp = ((x - z) / t) * 0.5 else: tmp = (y - z) / (2.0 * t) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -2e-208) tmp = Float64(Float64(Float64(x - z) / t) * 0.5); else tmp = Float64(Float64(y - z) / Float64(2.0 * t)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((x + y) <= -2e-208)
tmp = ((x - z) / t) * 0.5;
else
tmp = (y - z) / (2.0 * t);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -2e-208], N[(N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(y - z), $MachinePrecision] / N[(2.0 * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -2 \cdot 10^{-208}:\\
\;\;\;\;\frac{x - z}{t} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{2 \cdot t}\\
\end{array}
\end{array}
if (+.f64 x y) < -2.0000000000000002e-208Initial program 99.2%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6462.9
Applied rewrites62.9%
if -2.0000000000000002e-208 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6461.9
Applied rewrites61.9%
Taylor expanded in x around 0
lower--.f6470.6
Applied rewrites70.6%
Final simplification66.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= (+ x y) -0.005) (* (/ x t) 0.5) (if (<= (+ x y) 4e+35) (/ (- z) (* 2.0 t)) (/ (* y 0.5) t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -0.005) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 4e+35) {
tmp = -z / (2.0 * t);
} else {
tmp = (y * 0.5) / t;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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) <= (-0.005d0)) then
tmp = (x / t) * 0.5d0
else if ((x + y) <= 4d+35) then
tmp = -z / (2.0d0 * t)
else
tmp = (y * 0.5d0) / t
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -0.005) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 4e+35) {
tmp = -z / (2.0 * t);
} else {
tmp = (y * 0.5) / t;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (x + y) <= -0.005: tmp = (x / t) * 0.5 elif (x + y) <= 4e+35: tmp = -z / (2.0 * t) else: tmp = (y * 0.5) / t return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -0.005) tmp = Float64(Float64(x / t) * 0.5); elseif (Float64(x + y) <= 4e+35) tmp = Float64(Float64(-z) / Float64(2.0 * t)); else tmp = Float64(Float64(y * 0.5) / t); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((x + y) <= -0.005)
tmp = (x / t) * 0.5;
elseif ((x + y) <= 4e+35)
tmp = -z / (2.0 * t);
else
tmp = (y * 0.5) / t;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -0.005], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 4e+35], N[((-z) / N[(2.0 * t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 0.5), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -0.005:\\
\;\;\;\;\frac{x}{t} \cdot 0.5\\
\mathbf{elif}\;x + y \leq 4 \cdot 10^{+35}:\\
\;\;\;\;\frac{-z}{2 \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot 0.5}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < -0.0050000000000000001Initial program 99.1%
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-/.f6426.0
Applied rewrites26.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6435.5
Applied rewrites35.5%
if -0.0050000000000000001 < (+.f64 x y) < 3.9999999999999999e35Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6473.7
Applied rewrites73.7%
if 3.9999999999999999e35 < (+.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-/.f6443.0
Applied rewrites43.0%
Applied rewrites43.1%
Final simplification48.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= (+ x y) -0.005) (* (/ x t) 0.5) (if (<= (+ x y) 4e+35) (/ (* -0.5 z) t) (/ (* y 0.5) t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -0.005) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 4e+35) {
tmp = (-0.5 * z) / t;
} else {
tmp = (y * 0.5) / t;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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) <= (-0.005d0)) then
tmp = (x / t) * 0.5d0
else if ((x + y) <= 4d+35) then
tmp = ((-0.5d0) * z) / t
else
tmp = (y * 0.5d0) / t
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -0.005) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 4e+35) {
tmp = (-0.5 * z) / t;
} else {
tmp = (y * 0.5) / t;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (x + y) <= -0.005: tmp = (x / t) * 0.5 elif (x + y) <= 4e+35: tmp = (-0.5 * z) / t else: tmp = (y * 0.5) / t return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -0.005) tmp = Float64(Float64(x / t) * 0.5); elseif (Float64(x + y) <= 4e+35) tmp = Float64(Float64(-0.5 * z) / t); else tmp = Float64(Float64(y * 0.5) / t); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((x + y) <= -0.005)
tmp = (x / t) * 0.5;
elseif ((x + y) <= 4e+35)
tmp = (-0.5 * z) / t;
else
tmp = (y * 0.5) / t;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -0.005], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 4e+35], N[(N[(-0.5 * z), $MachinePrecision] / t), $MachinePrecision], N[(N[(y * 0.5), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -0.005:\\
\;\;\;\;\frac{x}{t} \cdot 0.5\\
\mathbf{elif}\;x + y \leq 4 \cdot 10^{+35}:\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot 0.5}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < -0.0050000000000000001Initial program 99.1%
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-/.f6426.0
Applied rewrites26.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6435.5
Applied rewrites35.5%
if -0.0050000000000000001 < (+.f64 x y) < 3.9999999999999999e35Initial 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-/.f6473.4
Applied rewrites73.4%
Applied rewrites73.7%
if 3.9999999999999999e35 < (+.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-/.f6443.0
Applied rewrites43.0%
Applied rewrites43.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= (+ x y) -0.005) (* (/ x t) 0.5) (if (<= (+ x y) 4e+35) (/ (* -0.5 z) t) (* y (/ 0.5 t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -0.005) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 4e+35) {
tmp = (-0.5 * z) / t;
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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) <= (-0.005d0)) then
tmp = (x / t) * 0.5d0
else if ((x + y) <= 4d+35) then
tmp = ((-0.5d0) * z) / t
else
tmp = y * (0.5d0 / t)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -0.005) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 4e+35) {
tmp = (-0.5 * z) / t;
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (x + y) <= -0.005: tmp = (x / t) * 0.5 elif (x + y) <= 4e+35: tmp = (-0.5 * z) / t else: tmp = y * (0.5 / t) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -0.005) tmp = Float64(Float64(x / t) * 0.5); elseif (Float64(x + y) <= 4e+35) tmp = Float64(Float64(-0.5 * z) / t); else tmp = Float64(y * Float64(0.5 / t)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((x + y) <= -0.005)
tmp = (x / t) * 0.5;
elseif ((x + y) <= 4e+35)
tmp = (-0.5 * z) / t;
else
tmp = y * (0.5 / t);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -0.005], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 4e+35], N[(N[(-0.5 * z), $MachinePrecision] / t), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -0.005:\\
\;\;\;\;\frac{x}{t} \cdot 0.5\\
\mathbf{elif}\;x + y \leq 4 \cdot 10^{+35}:\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < -0.0050000000000000001Initial program 99.1%
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-/.f6426.0
Applied rewrites26.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6435.5
Applied rewrites35.5%
if -0.0050000000000000001 < (+.f64 x y) < 3.9999999999999999e35Initial 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-/.f6473.4
Applied rewrites73.4%
Applied rewrites73.7%
if 3.9999999999999999e35 < (+.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-/.f6443.0
Applied rewrites43.0%
Final simplification48.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= (+ x y) -0.005) (* (/ x t) 0.5) (if (<= (+ x y) 4e+35) (* (/ -0.5 t) z) (* y (/ 0.5 t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -0.005) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 4e+35) {
tmp = (-0.5 / t) * z;
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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) <= (-0.005d0)) then
tmp = (x / t) * 0.5d0
else if ((x + y) <= 4d+35) then
tmp = ((-0.5d0) / t) * z
else
tmp = y * (0.5d0 / t)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -0.005) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 4e+35) {
tmp = (-0.5 / t) * z;
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (x + y) <= -0.005: tmp = (x / t) * 0.5 elif (x + y) <= 4e+35: tmp = (-0.5 / t) * z else: tmp = y * (0.5 / t) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -0.005) tmp = Float64(Float64(x / t) * 0.5); elseif (Float64(x + y) <= 4e+35) tmp = Float64(Float64(-0.5 / t) * z); else tmp = Float64(y * Float64(0.5 / t)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((x + y) <= -0.005)
tmp = (x / t) * 0.5;
elseif ((x + y) <= 4e+35)
tmp = (-0.5 / t) * z;
else
tmp = y * (0.5 / t);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -0.005], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 4e+35], N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -0.005:\\
\;\;\;\;\frac{x}{t} \cdot 0.5\\
\mathbf{elif}\;x + y \leq 4 \cdot 10^{+35}:\\
\;\;\;\;\frac{-0.5}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < -0.0050000000000000001Initial program 99.1%
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-/.f6426.0
Applied rewrites26.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6435.5
Applied rewrites35.5%
if -0.0050000000000000001 < (+.f64 x y) < 3.9999999999999999e35Initial 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-/.f6473.4
Applied rewrites73.4%
if 3.9999999999999999e35 < (+.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-/.f6443.0
Applied rewrites43.0%
Final simplification48.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= (+ x y) -0.005) (* x (/ 0.5 t)) (if (<= (+ x y) 4e+35) (* (/ -0.5 t) z) (* y (/ 0.5 t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -0.005) {
tmp = x * (0.5 / t);
} else if ((x + y) <= 4e+35) {
tmp = (-0.5 / t) * z;
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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) <= (-0.005d0)) then
tmp = x * (0.5d0 / t)
else if ((x + y) <= 4d+35) then
tmp = ((-0.5d0) / t) * z
else
tmp = y * (0.5d0 / t)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -0.005) {
tmp = x * (0.5 / t);
} else if ((x + y) <= 4e+35) {
tmp = (-0.5 / t) * z;
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (x + y) <= -0.005: tmp = x * (0.5 / t) elif (x + y) <= 4e+35: tmp = (-0.5 / t) * z else: tmp = y * (0.5 / t) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -0.005) tmp = Float64(x * Float64(0.5 / t)); elseif (Float64(x + y) <= 4e+35) tmp = Float64(Float64(-0.5 / t) * z); else tmp = Float64(y * Float64(0.5 / t)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((x + y) <= -0.005)
tmp = x * (0.5 / t);
elseif ((x + y) <= 4e+35)
tmp = (-0.5 / t) * z;
else
tmp = y * (0.5 / t);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -0.005], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 4e+35], N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -0.005:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\mathbf{elif}\;x + y \leq 4 \cdot 10^{+35}:\\
\;\;\;\;\frac{-0.5}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < -0.0050000000000000001Initial program 99.1%
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-/.f6435.4
Applied rewrites35.4%
if -0.0050000000000000001 < (+.f64 x y) < 3.9999999999999999e35Initial 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-/.f6473.4
Applied rewrites73.4%
if 3.9999999999999999e35 < (+.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-/.f6443.0
Applied rewrites43.0%
Final simplification48.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= (+ x y) -2e-208) (* (/ (- x z) t) 0.5) (* (/ (- y z) t) 0.5)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -2e-208) {
tmp = ((x - z) / t) * 0.5;
} else {
tmp = ((y - z) / t) * 0.5;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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-208)) then
tmp = ((x - z) / t) * 0.5d0
else
tmp = ((y - z) / t) * 0.5d0
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -2e-208) {
tmp = ((x - z) / t) * 0.5;
} else {
tmp = ((y - z) / t) * 0.5;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (x + y) <= -2e-208: tmp = ((x - z) / t) * 0.5 else: tmp = ((y - z) / t) * 0.5 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -2e-208) tmp = Float64(Float64(Float64(x - z) / t) * 0.5); else tmp = Float64(Float64(Float64(y - z) / t) * 0.5); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((x + y) <= -2e-208)
tmp = ((x - z) / t) * 0.5;
else
tmp = ((y - z) / t) * 0.5;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -2e-208], N[(N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -2 \cdot 10^{-208}:\\
\;\;\;\;\frac{x - z}{t} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -2.0000000000000002e-208Initial program 99.2%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6462.9
Applied rewrites62.9%
if -2.0000000000000002e-208 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6470.6
Applied rewrites70.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= (+ x y) 4e+35) (* (/ (- x z) t) 0.5) (/ (* y 0.5) t)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 4e+35) {
tmp = ((x - z) / t) * 0.5;
} else {
tmp = (y * 0.5) / t;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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) <= 4d+35) then
tmp = ((x - z) / t) * 0.5d0
else
tmp = (y * 0.5d0) / t
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 4e+35) {
tmp = ((x - z) / t) * 0.5;
} else {
tmp = (y * 0.5) / t;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (x + y) <= 4e+35: tmp = ((x - z) / t) * 0.5 else: tmp = (y * 0.5) / t return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= 4e+35) tmp = Float64(Float64(Float64(x - z) / t) * 0.5); else tmp = Float64(Float64(y * 0.5) / t); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((x + y) <= 4e+35)
tmp = ((x - z) / t) * 0.5;
else
tmp = (y * 0.5) / t;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], 4e+35], N[(N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(y * 0.5), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 4 \cdot 10^{+35}:\\
\;\;\;\;\frac{x - z}{t} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot 0.5}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < 3.9999999999999999e35Initial program 99.4%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6470.2
Applied rewrites70.2%
if 3.9999999999999999e35 < (+.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-/.f6443.0
Applied rewrites43.0%
Applied rewrites43.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= (+ x y) -0.005) (* x (/ 0.5 t)) (* (/ -0.5 t) z)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -0.005) {
tmp = x * (0.5 / t);
} else {
tmp = (-0.5 / t) * z;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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) <= (-0.005d0)) then
tmp = x * (0.5d0 / t)
else
tmp = ((-0.5d0) / t) * z
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -0.005) {
tmp = x * (0.5 / t);
} else {
tmp = (-0.5 / t) * z;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (x + y) <= -0.005: tmp = x * (0.5 / t) else: tmp = (-0.5 / t) * z return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -0.005) tmp = Float64(x * Float64(0.5 / t)); else tmp = Float64(Float64(-0.5 / t) * z); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((x + y) <= -0.005)
tmp = x * (0.5 / t);
else
tmp = (-0.5 / t) * z;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -0.005], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -0.005:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{t} \cdot z\\
\end{array}
\end{array}
if (+.f64 x y) < -0.0050000000000000001Initial program 99.1%
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-/.f6435.4
Applied rewrites35.4%
if -0.0050000000000000001 < (+.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-/.f6449.9
Applied rewrites49.9%
Final simplification43.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* (- (+ x y) z) (/ 0.5 t)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return ((x + y) - z) * (0.5 / t);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) * (0.5 / t);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return ((x + y) - z) * (0.5 / t)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) * Float64(0.5 / t)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = ((x + y) - z) * (0.5 / t);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\left(x + y\right) - z\right) \cdot \frac{0.5}{t}
\end{array}
Initial program 99.6%
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%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* (/ -0.5 t) z))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (-0.5 / t) * z;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return (-0.5 / t) * z;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (-0.5 / t) * z
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(-0.5 / t) * z) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (-0.5 / t) * z;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{-0.5}{t} \cdot z
\end{array}
Initial program 99.6%
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-/.f6440.0
Applied rewrites40.0%
herbie shell --seed 2024243
(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)))