
(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 9 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 (/ (- y (- z x)) (+ t t)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (y - (z - x)) / (t + 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 = (y - (z - x)) / (t + t)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return (y - (z - x)) / (t + t);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (y - (z - x)) / (t + t)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(y - Float64(z - x)) / Float64(t + t)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (y - (z - x)) / (t + 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[(y - N[(z - x), $MachinePrecision]), $MachinePrecision] / N[(t + t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{y - \left(z - x\right)}{t + 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%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f64100.0
Applied rewrites100.0%
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) z) (* t 2.0)) -1e-306) (* x (/ 0.5 t)) (* (/ y 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) - z) / (t * 2.0)) <= -1e-306) {
tmp = x * (0.5 / t);
} else {
tmp = (y / 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) - z) / (t * 2.0d0)) <= (-1d-306)) then
tmp = x * (0.5d0 / t)
else
tmp = (y / 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) - z) / (t * 2.0)) <= -1e-306) {
tmp = x * (0.5 / t);
} else {
tmp = (y / 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) - z) / (t * 2.0)) <= -1e-306: tmp = x * (0.5 / t) else: tmp = (y / 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(Float64(Float64(x + y) - z) / Float64(t * 2.0)) <= -1e-306) tmp = Float64(x * Float64(0.5 / t)); else tmp = Float64(Float64(y / 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) - z) / (t * 2.0)) <= -1e-306)
tmp = x * (0.5 / t);
else
tmp = (y / 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[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], -1e-306], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{\left(x + y\right) - z}{t \cdot 2} \leq -1 \cdot 10^{-306}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 x y) z) (*.f64 t #s(literal 2 binary64))) < -1.00000000000000003e-306Initial program 99.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6434.2
Applied rewrites34.2%
Applied rewrites34.1%
if -1.00000000000000003e-306 < (/.f64 (-.f64 (+.f64 x y) z) (*.f64 t #s(literal 2 binary64))) Initial program 100.0%
Taylor expanded in z around 0
div-add-revN/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6467.7
Applied rewrites67.7%
Taylor expanded in x around 0
Applied rewrites40.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) -1e-74) (* (/ x t) 0.5) (if (<= (+ x y) 2e+48) (/ (* -0.5 z) t) (* (/ y 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) <= -1e-74) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 2e+48) {
tmp = (-0.5 * z) / t;
} else {
tmp = (y / 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) <= (-1d-74)) then
tmp = (x / t) * 0.5d0
else if ((x + y) <= 2d+48) then
tmp = ((-0.5d0) * z) / t
else
tmp = (y / 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) <= -1e-74) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 2e+48) {
tmp = (-0.5 * z) / t;
} else {
tmp = (y / 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) <= -1e-74: tmp = (x / t) * 0.5 elif (x + y) <= 2e+48: tmp = (-0.5 * z) / t else: tmp = (y / 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) <= -1e-74) tmp = Float64(Float64(x / t) * 0.5); elseif (Float64(x + y) <= 2e+48) tmp = Float64(Float64(-0.5 * z) / t); else tmp = Float64(Float64(y / 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) <= -1e-74)
tmp = (x / t) * 0.5;
elseif ((x + y) <= 2e+48)
tmp = (-0.5 * z) / t;
else
tmp = (y / 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], -1e-74], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 2e+48], N[(N[(-0.5 * z), $MachinePrecision] / t), $MachinePrecision], N[(N[(y / 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 -1 \cdot 10^{-74}:\\
\;\;\;\;\frac{x}{t} \cdot 0.5\\
\mathbf{elif}\;x + y \leq 2 \cdot 10^{+48}:\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -9.99999999999999958e-75Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6444.5
Applied rewrites44.5%
if -9.99999999999999958e-75 < (+.f64 x y) < 2.00000000000000009e48Initial program 99.9%
Taylor expanded in z around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6463.5
Applied rewrites63.5%
Applied rewrites63.7%
if 2.00000000000000009e48 < (+.f64 x y) Initial program 99.9%
Taylor expanded in z around 0
div-add-revN/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6480.8
Applied rewrites80.8%
Taylor expanded in x around 0
Applied rewrites47.5%
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) -1e-74) (* (/ x t) 0.5) (if (<= (+ x y) 2e+48) (* (/ -0.5 t) z) (* (/ y 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) <= -1e-74) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 2e+48) {
tmp = (-0.5 / t) * z;
} else {
tmp = (y / 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) <= (-1d-74)) then
tmp = (x / t) * 0.5d0
else if ((x + y) <= 2d+48) then
tmp = ((-0.5d0) / t) * z
else
tmp = (y / 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) <= -1e-74) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 2e+48) {
tmp = (-0.5 / t) * z;
} else {
tmp = (y / 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) <= -1e-74: tmp = (x / t) * 0.5 elif (x + y) <= 2e+48: tmp = (-0.5 / t) * z else: tmp = (y / 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) <= -1e-74) tmp = Float64(Float64(x / t) * 0.5); elseif (Float64(x + y) <= 2e+48) tmp = Float64(Float64(-0.5 / t) * z); else tmp = Float64(Float64(y / 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) <= -1e-74)
tmp = (x / t) * 0.5;
elseif ((x + y) <= 2e+48)
tmp = (-0.5 / t) * z;
else
tmp = (y / 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], -1e-74], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 2e+48], N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision], N[(N[(y / 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 -1 \cdot 10^{-74}:\\
\;\;\;\;\frac{x}{t} \cdot 0.5\\
\mathbf{elif}\;x + y \leq 2 \cdot 10^{+48}:\\
\;\;\;\;\frac{-0.5}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -9.99999999999999958e-75Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6444.5
Applied rewrites44.5%
if -9.99999999999999958e-75 < (+.f64 x y) < 2.00000000000000009e48Initial program 99.9%
Taylor expanded in z around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6463.5
Applied rewrites63.5%
if 2.00000000000000009e48 < (+.f64 x y) Initial program 99.9%
Taylor expanded in z around 0
div-add-revN/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6480.8
Applied rewrites80.8%
Taylor expanded in x around 0
Applied rewrites47.5%
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) -1e-74) (* x (/ 0.5 t)) (if (<= (+ x y) 2e+48) (* (/ -0.5 t) z) (* (/ y 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) <= -1e-74) {
tmp = x * (0.5 / t);
} else if ((x + y) <= 2e+48) {
tmp = (-0.5 / t) * z;
} else {
tmp = (y / 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) <= (-1d-74)) then
tmp = x * (0.5d0 / t)
else if ((x + y) <= 2d+48) then
tmp = ((-0.5d0) / t) * z
else
tmp = (y / 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) <= -1e-74) {
tmp = x * (0.5 / t);
} else if ((x + y) <= 2e+48) {
tmp = (-0.5 / t) * z;
} else {
tmp = (y / 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) <= -1e-74: tmp = x * (0.5 / t) elif (x + y) <= 2e+48: tmp = (-0.5 / t) * z else: tmp = (y / 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) <= -1e-74) tmp = Float64(x * Float64(0.5 / t)); elseif (Float64(x + y) <= 2e+48) tmp = Float64(Float64(-0.5 / t) * z); else tmp = Float64(Float64(y / 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) <= -1e-74)
tmp = x * (0.5 / t);
elseif ((x + y) <= 2e+48)
tmp = (-0.5 / t) * z;
else
tmp = (y / 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], -1e-74], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 2e+48], N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision], N[(N[(y / 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 -1 \cdot 10^{-74}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\mathbf{elif}\;x + y \leq 2 \cdot 10^{+48}:\\
\;\;\;\;\frac{-0.5}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -9.99999999999999958e-75Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6444.5
Applied rewrites44.5%
Applied rewrites44.5%
if -9.99999999999999958e-75 < (+.f64 x y) < 2.00000000000000009e48Initial program 99.9%
Taylor expanded in z around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6463.5
Applied rewrites63.5%
if 2.00000000000000009e48 < (+.f64 x y) Initial program 99.9%
Taylor expanded in z around 0
div-add-revN/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6480.8
Applied rewrites80.8%
Taylor expanded in x around 0
Applied rewrites47.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= z -1.2e-59) (not (<= z 3.2e+34))) (/ (- x z) (+ t t)) (/ (+ y x) (+ t t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.2e-59) || !(z <= 3.2e+34)) {
tmp = (x - z) / (t + t);
} else {
tmp = (y + x) / (t + 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 ((z <= (-1.2d-59)) .or. (.not. (z <= 3.2d+34))) then
tmp = (x - z) / (t + t)
else
tmp = (y + x) / (t + 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 ((z <= -1.2e-59) || !(z <= 3.2e+34)) {
tmp = (x - z) / (t + t);
} else {
tmp = (y + x) / (t + t);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (z <= -1.2e-59) or not (z <= 3.2e+34): tmp = (x - z) / (t + t) else: tmp = (y + x) / (t + t) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if ((z <= -1.2e-59) || !(z <= 3.2e+34)) tmp = Float64(Float64(x - z) / Float64(t + t)); else tmp = Float64(Float64(y + x) / Float64(t + 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 ((z <= -1.2e-59) || ~((z <= 3.2e+34)))
tmp = (x - z) / (t + t);
else
tmp = (y + x) / (t + 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[Or[LessEqual[z, -1.2e-59], N[Not[LessEqual[z, 3.2e+34]], $MachinePrecision]], N[(N[(x - z), $MachinePrecision] / N[(t + t), $MachinePrecision]), $MachinePrecision], N[(N[(y + x), $MachinePrecision] / N[(t + t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{-59} \lor \neg \left(z \leq 3.2 \cdot 10^{+34}\right):\\
\;\;\;\;\frac{x - z}{t + t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y + x}{t + t}\\
\end{array}
\end{array}
if z < -1.20000000000000008e-59 or 3.1999999999999998e34 < z 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%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
lower--.f6485.2
Applied rewrites85.2%
if -1.20000000000000008e-59 < z < 3.1999999999999998e34Initial program 100.0%
Taylor expanded in x around 0
lower--.f6462.3
Applied rewrites62.3%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6462.3
Applied rewrites62.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6493.8
Applied rewrites93.8%
Final simplification89.5%
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) -1e-200) (/ (- x z) (+ t t)) (/ (- y z) (+ t t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e-200) {
tmp = (x - z) / (t + t);
} else {
tmp = (y - z) / (t + 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) <= (-1d-200)) then
tmp = (x - z) / (t + t)
else
tmp = (y - z) / (t + 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) <= -1e-200) {
tmp = (x - z) / (t + t);
} else {
tmp = (y - z) / (t + t);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (x + y) <= -1e-200: tmp = (x - z) / (t + t) else: tmp = (y - z) / (t + 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) <= -1e-200) tmp = Float64(Float64(x - z) / Float64(t + t)); else tmp = Float64(Float64(y - z) / Float64(t + 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) <= -1e-200)
tmp = (x - z) / (t + t);
else
tmp = (y - z) / (t + 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], -1e-200], N[(N[(x - z), $MachinePrecision] / N[(t + t), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] / N[(t + t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{-200}:\\
\;\;\;\;\frac{x - z}{t + t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t + t}\\
\end{array}
\end{array}
if (+.f64 x y) < -9.9999999999999998e-201Initial 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%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
lower--.f6471.0
Applied rewrites71.0%
if -9.9999999999999998e-201 < (+.f64 x y) Initial program 99.9%
Taylor expanded in x around 0
lower--.f6476.6
Applied rewrites76.6%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6476.6
Applied rewrites76.6%
Final simplification73.9%
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+48) (/ (- x z) (+ t t)) (* (/ y 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+48) {
tmp = (x - z) / (t + t);
} else {
tmp = (y / 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+48) then
tmp = (x - z) / (t + t)
else
tmp = (y / 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+48) {
tmp = (x - z) / (t + t);
} else {
tmp = (y / 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+48: tmp = (x - z) / (t + t) else: tmp = (y / 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+48) tmp = Float64(Float64(x - z) / Float64(t + t)); else tmp = Float64(Float64(y / 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+48)
tmp = (x - z) / (t + t);
else
tmp = (y / 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+48], N[(N[(x - z), $MachinePrecision] / N[(t + t), $MachinePrecision]), $MachinePrecision], N[(N[(y / 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^{+48}:\\
\;\;\;\;\frac{x - z}{t + t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < 2.00000000000000009e48Initial 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%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
lower--.f6471.1
Applied rewrites71.1%
if 2.00000000000000009e48 < (+.f64 x y) Initial program 99.9%
Taylor expanded in z around 0
div-add-revN/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6480.8
Applied rewrites80.8%
Taylor expanded in x around 0
Applied rewrites47.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* x (/ 0.5 t)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return x * (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 * (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 * (0.5 / t);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return x * (0.5 / t)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(x * Float64(0.5 / t)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = x * (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[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
x \cdot \frac{0.5}{t}
\end{array}
Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6434.0
Applied rewrites34.0%
Applied rewrites33.9%
herbie shell --seed 2024337
(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)))