
(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 13 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 (/ (- (+ 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}
Initial program 100.0%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -5e-8) (* (/ x t) 0.5) (if (<= (+ x y) 1e-45) (/ (* -0.5 z) t) (* (/ y t) 0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-8) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 1e-45) {
tmp = (-0.5 * z) / t;
} else {
tmp = (y / t) * 0.5;
}
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-8)) then
tmp = (x / t) * 0.5d0
else if ((x + y) <= 1d-45) then
tmp = ((-0.5d0) * z) / t
else
tmp = (y / t) * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-8) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 1e-45) {
tmp = (-0.5 * z) / t;
} else {
tmp = (y / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -5e-8: tmp = (x / t) * 0.5 elif (x + y) <= 1e-45: tmp = (-0.5 * z) / t else: tmp = (y / t) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -5e-8) tmp = Float64(Float64(x / t) * 0.5); elseif (Float64(x + y) <= 1e-45) tmp = Float64(Float64(-0.5 * z) / t); else tmp = Float64(Float64(y / t) * 0.5); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -5e-8) tmp = (x / t) * 0.5; elseif ((x + y) <= 1e-45) tmp = (-0.5 * z) / t; else tmp = (y / t) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -5e-8], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 1e-45], N[(N[(-0.5 * z), $MachinePrecision] / t), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * 0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -5 \cdot 10^{-8}:\\
\;\;\;\;\frac{x}{t} \cdot 0.5\\
\mathbf{elif}\;x + y \leq 10^{-45}:\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -4.9999999999999998e-8Initial program 99.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6438.8
Applied rewrites38.8%
if -4.9999999999999998e-8 < (+.f64 x y) < 9.99999999999999984e-46Initial 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-/.f6480.4
Applied rewrites80.4%
Applied rewrites80.7%
if 9.99999999999999984e-46 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6484.5
Applied rewrites84.5%
Taylor expanded in x around 0
Applied rewrites42.1%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -5e-8) (* (/ x t) 0.5) (if (<= (+ x y) 1e-45) (* (/ -0.5 t) z) (* (/ y t) 0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-8) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 1e-45) {
tmp = (-0.5 / t) * z;
} else {
tmp = (y / t) * 0.5;
}
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-8)) then
tmp = (x / t) * 0.5d0
else if ((x + y) <= 1d-45) then
tmp = ((-0.5d0) / t) * z
else
tmp = (y / t) * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-8) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 1e-45) {
tmp = (-0.5 / t) * z;
} else {
tmp = (y / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -5e-8: tmp = (x / t) * 0.5 elif (x + y) <= 1e-45: tmp = (-0.5 / t) * z else: tmp = (y / t) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -5e-8) tmp = Float64(Float64(x / t) * 0.5); elseif (Float64(x + y) <= 1e-45) tmp = Float64(Float64(-0.5 / t) * z); else tmp = Float64(Float64(y / t) * 0.5); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -5e-8) tmp = (x / t) * 0.5; elseif ((x + y) <= 1e-45) tmp = (-0.5 / t) * z; else tmp = (y / t) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -5e-8], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 1e-45], N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * 0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -5 \cdot 10^{-8}:\\
\;\;\;\;\frac{x}{t} \cdot 0.5\\
\mathbf{elif}\;x + y \leq 10^{-45}:\\
\;\;\;\;\frac{-0.5}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -4.9999999999999998e-8Initial program 99.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6438.8
Applied rewrites38.8%
if -4.9999999999999998e-8 < (+.f64 x y) < 9.99999999999999984e-46Initial 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-/.f6480.4
Applied rewrites80.4%
if 9.99999999999999984e-46 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6484.5
Applied rewrites84.5%
Taylor expanded in x around 0
Applied rewrites42.1%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -5e-8) (* x (/ 0.5 t)) (if (<= (+ x y) 1e-45) (* (/ -0.5 t) z) (* (/ y t) 0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-8) {
tmp = x * (0.5 / t);
} else if ((x + y) <= 1e-45) {
tmp = (-0.5 / t) * z;
} else {
tmp = (y / t) * 0.5;
}
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-8)) then
tmp = x * (0.5d0 / t)
else if ((x + y) <= 1d-45) then
tmp = ((-0.5d0) / t) * z
else
tmp = (y / t) * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-8) {
tmp = x * (0.5 / t);
} else if ((x + y) <= 1e-45) {
tmp = (-0.5 / t) * z;
} else {
tmp = (y / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -5e-8: tmp = x * (0.5 / t) elif (x + y) <= 1e-45: tmp = (-0.5 / t) * z else: tmp = (y / t) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -5e-8) tmp = Float64(x * Float64(0.5 / t)); elseif (Float64(x + y) <= 1e-45) tmp = Float64(Float64(-0.5 / t) * z); else tmp = Float64(Float64(y / t) * 0.5); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -5e-8) tmp = x * (0.5 / t); elseif ((x + y) <= 1e-45) tmp = (-0.5 / t) * z; else tmp = (y / t) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -5e-8], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 1e-45], N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * 0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -5 \cdot 10^{-8}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\mathbf{elif}\;x + y \leq 10^{-45}:\\
\;\;\;\;\frac{-0.5}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -4.9999999999999998e-8Initial program 99.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6438.8
Applied rewrites38.8%
Applied rewrites38.8%
if -4.9999999999999998e-8 < (+.f64 x y) < 9.99999999999999984e-46Initial 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-/.f6480.4
Applied rewrites80.4%
if 9.99999999999999984e-46 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6484.5
Applied rewrites84.5%
Taylor expanded in x around 0
Applied rewrites42.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.3e+167) (not (<= z 4.5e+143))) (/ (* -0.5 z) t) (* (/ (+ y x) t) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.3e+167) || !(z <= 4.5e+143)) {
tmp = (-0.5 * z) / t;
} else {
tmp = ((y + x) / t) * 0.5;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.3d+167)) .or. (.not. (z <= 4.5d+143))) then
tmp = ((-0.5d0) * z) / t
else
tmp = ((y + x) / t) * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.3e+167) || !(z <= 4.5e+143)) {
tmp = (-0.5 * z) / t;
} else {
tmp = ((y + x) / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.3e+167) or not (z <= 4.5e+143): tmp = (-0.5 * z) / t else: tmp = ((y + x) / t) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.3e+167) || !(z <= 4.5e+143)) tmp = Float64(Float64(-0.5 * z) / t); else tmp = Float64(Float64(Float64(y + x) / t) * 0.5); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.3e+167) || ~((z <= 4.5e+143))) tmp = (-0.5 * z) / t; else tmp = ((y + x) / t) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.3e+167], N[Not[LessEqual[z, 4.5e+143]], $MachinePrecision]], N[(N[(-0.5 * z), $MachinePrecision] / t), $MachinePrecision], N[(N[(N[(y + x), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+167} \lor \neg \left(z \leq 4.5 \cdot 10^{+143}\right):\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y + x}{t} \cdot 0.5\\
\end{array}
\end{array}
if z < -1.3000000000000001e167 or 4.4999999999999997e143 < z Initial program 99.9%
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-/.f6483.4
Applied rewrites83.4%
Applied rewrites83.6%
if -1.3000000000000001e167 < z < 4.4999999999999997e143Initial program 100.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6487.7
Applied rewrites87.7%
Final simplification86.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.3e+167) (not (<= z 4.5e+143))) (/ (* -0.5 z) t) (* (+ x y) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.3e+167) || !(z <= 4.5e+143)) {
tmp = (-0.5 * z) / t;
} else {
tmp = (x + y) * (0.5 / 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 ((z <= (-1.3d+167)) .or. (.not. (z <= 4.5d+143))) then
tmp = ((-0.5d0) * z) / t
else
tmp = (x + y) * (0.5d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.3e+167) || !(z <= 4.5e+143)) {
tmp = (-0.5 * z) / t;
} else {
tmp = (x + y) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.3e+167) or not (z <= 4.5e+143): tmp = (-0.5 * z) / t else: tmp = (x + y) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.3e+167) || !(z <= 4.5e+143)) tmp = Float64(Float64(-0.5 * z) / t); else tmp = Float64(Float64(x + y) * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.3e+167) || ~((z <= 4.5e+143))) tmp = (-0.5 * z) / t; else tmp = (x + y) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.3e+167], N[Not[LessEqual[z, 4.5e+143]], $MachinePrecision]], N[(N[(-0.5 * z), $MachinePrecision] / t), $MachinePrecision], N[(N[(x + y), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+167} \lor \neg \left(z \leq 4.5 \cdot 10^{+143}\right):\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if z < -1.3000000000000001e167 or 4.4999999999999997e143 < z Initial program 99.9%
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-/.f6483.4
Applied rewrites83.4%
Applied rewrites83.6%
if -1.3000000000000001e167 < z < 4.4999999999999997e143Initial program 100.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6487.7
Applied rewrites87.7%
Applied rewrites87.5%
Final simplification86.6%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -4e-161) (/ (- x z) (* t 2.0)) (/ (- y z) (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -4e-161) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (y - z) / (t * 2.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 + y) <= (-4d-161)) then
tmp = (x - z) / (t * 2.0d0)
else
tmp = (y - z) / (t * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -4e-161) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (y - z) / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -4e-161: tmp = (x - z) / (t * 2.0) else: tmp = (y - z) / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -4e-161) tmp = Float64(Float64(x - z) / Float64(t * 2.0)); else tmp = Float64(Float64(y - z) / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -4e-161) tmp = (x - z) / (t * 2.0); else tmp = (y - z) / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -4e-161], N[(N[(x - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -4 \cdot 10^{-161}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t \cdot 2}\\
\end{array}
\end{array}
if (+.f64 x y) < -4.00000000000000011e-161Initial program 99.9%
Taylor expanded in y around 0
lower--.f6461.8
Applied rewrites61.8%
if -4.00000000000000011e-161 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0
lower--.f6464.6
Applied rewrites64.6%
Final simplification63.3%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) 5e-196) (/ (- x z) (* t 2.0)) (* (/ 0.5 t) (- y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 5e-196) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (0.5 / t) * (y - 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) <= 5d-196) then
tmp = (x - z) / (t * 2.0d0)
else
tmp = (0.5d0 / t) * (y - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 5e-196) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (0.5 / t) * (y - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= 5e-196: tmp = (x - z) / (t * 2.0) else: tmp = (0.5 / t) * (y - z) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= 5e-196) tmp = Float64(Float64(x - z) / Float64(t * 2.0)); else tmp = Float64(Float64(0.5 / t) * Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= 5e-196) tmp = (x - z) / (t * 2.0); else tmp = (0.5 / t) * (y - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], 5e-196], N[(N[(x - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 5 \cdot 10^{-196}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(y - z\right)\\
\end{array}
\end{array}
if (+.f64 x y) < 5.0000000000000005e-196Initial program 99.9%
Taylor expanded in y around 0
lower--.f6464.2
Applied rewrites64.2%
if 5.0000000000000005e-196 < (+.f64 x y) 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%
Taylor expanded in x around 0
lower--.f6462.1
Applied rewrites62.1%
Final simplification63.2%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -4e-161) (* (/ 0.5 t) (- x z)) (* (/ 0.5 t) (- y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -4e-161) {
tmp = (0.5 / t) * (x - z);
} else {
tmp = (0.5 / t) * (y - 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) <= (-4d-161)) then
tmp = (0.5d0 / t) * (x - z)
else
tmp = (0.5d0 / t) * (y - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -4e-161) {
tmp = (0.5 / t) * (x - z);
} else {
tmp = (0.5 / t) * (y - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -4e-161: tmp = (0.5 / t) * (x - z) else: tmp = (0.5 / t) * (y - z) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -4e-161) tmp = Float64(Float64(0.5 / t) * Float64(x - z)); else tmp = Float64(Float64(0.5 / t) * Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -4e-161) tmp = (0.5 / t) * (x - z); else tmp = (0.5 / t) * (y - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -4e-161], N[(N[(0.5 / t), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -4 \cdot 10^{-161}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(x - z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(y - z\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -4.00000000000000011e-161Initial program 99.9%
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%
Taylor expanded in y around 0
lower--.f6461.7
Applied rewrites61.7%
if -4.00000000000000011e-161 < (+.f64 x y) 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%
Taylor expanded in x around 0
lower--.f6464.4
Applied rewrites64.4%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) 1e-45) (* (/ 0.5 t) (- x z)) (* (/ (+ y x) t) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 1e-45) {
tmp = (0.5 / t) * (x - z);
} else {
tmp = ((y + x) / t) * 0.5;
}
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-45) then
tmp = (0.5d0 / t) * (x - z)
else
tmp = ((y + x) / t) * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 1e-45) {
tmp = (0.5 / t) * (x - z);
} else {
tmp = ((y + x) / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= 1e-45: tmp = (0.5 / t) * (x - z) else: tmp = ((y + x) / t) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= 1e-45) tmp = Float64(Float64(0.5 / t) * Float64(x - z)); else tmp = Float64(Float64(Float64(y + x) / t) * 0.5); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= 1e-45) tmp = (0.5 / t) * (x - z); else tmp = ((y + x) / t) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], 1e-45], N[(N[(0.5 / t), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y + x), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 10^{-45}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(x - z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y + x}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < 9.99999999999999984e-46Initial program 99.9%
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%
Taylor expanded in y around 0
lower--.f6465.5
Applied rewrites65.5%
if 9.99999999999999984e-46 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6484.5
Applied rewrites84.5%
(FPCore (x y z t) :precision binary64 (if (<= (- (+ x y) z) -1e-184) (* x (/ 0.5 t)) (* (/ y t) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x + y) - z) <= -1e-184) {
tmp = x * (0.5 / t);
} else {
tmp = (y / t) * 0.5;
}
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) - z) <= (-1d-184)) then
tmp = x * (0.5d0 / t)
else
tmp = (y / t) * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x + y) - z) <= -1e-184) {
tmp = x * (0.5 / t);
} else {
tmp = (y / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x + y) - z) <= -1e-184: tmp = x * (0.5 / t) else: tmp = (y / t) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(x + y) - z) <= -1e-184) tmp = Float64(x * Float64(0.5 / t)); else tmp = Float64(Float64(y / t) * 0.5); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x + y) - z) <= -1e-184) tmp = x * (0.5 / t); else tmp = (y / t) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision], -1e-184], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(x + y\right) - z \leq -1 \cdot 10^{-184}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) z) < -1.0000000000000001e-184Initial program 99.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6433.5
Applied rewrites33.5%
Applied rewrites33.4%
if -1.0000000000000001e-184 < (-.f64 (+.f64 x y) z) Initial program 100.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6474.9
Applied rewrites74.9%
Taylor expanded in x around 0
Applied rewrites38.8%
(FPCore (x y z t) :precision binary64 (* (/ 0.5 t) (- (+ y x) z)))
double code(double x, double y, double z, double t) {
return (0.5 / t) * ((y + x) - 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) * ((y + x) - z)
end function
public static double code(double x, double y, double z, double t) {
return (0.5 / t) * ((y + x) - z);
}
def code(x, y, z, t): return (0.5 / t) * ((y + x) - z)
function code(x, y, z, t) return Float64(Float64(0.5 / t) * Float64(Float64(y + x) - z)) end
function tmp = code(x, y, z, t) tmp = (0.5 / t) * ((y + x) - z); end
code[x_, y_, z_, t_] := N[(N[(0.5 / t), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5}{t} \cdot \left(\left(y + x\right) - z\right)
\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%
(FPCore (x y z t) :precision binary64 (* x (/ 0.5 t)))
double code(double x, double y, double z, double t) {
return x * (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 * (0.5d0 / t)
end function
public static double code(double x, double y, double z, double t) {
return x * (0.5 / t);
}
def code(x, y, z, t): return x * (0.5 / t)
function code(x, y, z, t) return Float64(x * Float64(0.5 / t)) end
function tmp = code(x, y, z, t) tmp = x * (0.5 / t); end
code[x_, y_, z_, t_] := N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{0.5}{t}
\end{array}
Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6437.6
Applied rewrites37.6%
Applied rewrites37.5%
herbie shell --seed 2024313
(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)))