
(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}
(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 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%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -2000000000000.0) (* (/ x t) 0.5) (if (<= (+ x y) 5e+46) (/ (* -0.5 z) t) (* (/ y t) 0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -2000000000000.0) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 5e+46) {
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) <= (-2000000000000.0d0)) then
tmp = (x / t) * 0.5d0
else if ((x + y) <= 5d+46) 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) <= -2000000000000.0) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 5e+46) {
tmp = (-0.5 * z) / t;
} else {
tmp = (y / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -2000000000000.0: tmp = (x / t) * 0.5 elif (x + y) <= 5e+46: 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) <= -2000000000000.0) tmp = Float64(Float64(x / t) * 0.5); elseif (Float64(x + y) <= 5e+46) 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) <= -2000000000000.0) tmp = (x / t) * 0.5; elseif ((x + y) <= 5e+46) 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], -2000000000000.0], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 5e+46], 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 -2000000000000:\\
\;\;\;\;\frac{x}{t} \cdot 0.5\\
\mathbf{elif}\;x + y \leq 5 \cdot 10^{+46}:\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -2e12Initial program 99.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6436.6
Applied rewrites36.6%
if -2e12 < (+.f64 x y) < 5.0000000000000002e46Initial 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-/.f6468.3
Applied rewrites68.3%
Applied rewrites68.5%
if 5.0000000000000002e46 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6485.4
Applied rewrites85.4%
Taylor expanded in x around 0
Applied rewrites42.1%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -2000000000000.0) (* (/ x t) 0.5) (if (<= (+ x y) 5e+46) (* (/ -0.5 t) z) (* (/ y t) 0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -2000000000000.0) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 5e+46) {
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) <= (-2000000000000.0d0)) then
tmp = (x / t) * 0.5d0
else if ((x + y) <= 5d+46) 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) <= -2000000000000.0) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 5e+46) {
tmp = (-0.5 / t) * z;
} else {
tmp = (y / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -2000000000000.0: tmp = (x / t) * 0.5 elif (x + y) <= 5e+46: 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) <= -2000000000000.0) tmp = Float64(Float64(x / t) * 0.5); elseif (Float64(x + y) <= 5e+46) 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) <= -2000000000000.0) tmp = (x / t) * 0.5; elseif ((x + y) <= 5e+46) 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], -2000000000000.0], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 5e+46], 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 -2000000000000:\\
\;\;\;\;\frac{x}{t} \cdot 0.5\\
\mathbf{elif}\;x + y \leq 5 \cdot 10^{+46}:\\
\;\;\;\;\frac{-0.5}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -2e12Initial program 99.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6436.6
Applied rewrites36.6%
if -2e12 < (+.f64 x y) < 5.0000000000000002e46Initial 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-/.f6468.3
Applied rewrites68.3%
if 5.0000000000000002e46 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6485.4
Applied rewrites85.4%
Taylor expanded in x around 0
Applied rewrites42.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.0037) (not (<= z 2.3e+24))) (/ (- x z) (* t 2.0)) (* (/ (+ y x) t) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.0037) || !(z <= 2.3e+24)) {
tmp = (x - z) / (t * 2.0);
} 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 <= (-0.0037d0)) .or. (.not. (z <= 2.3d+24))) then
tmp = (x - z) / (t * 2.0d0)
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 <= -0.0037) || !(z <= 2.3e+24)) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = ((y + x) / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.0037) or not (z <= 2.3e+24): tmp = (x - z) / (t * 2.0) else: tmp = ((y + x) / t) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.0037) || !(z <= 2.3e+24)) tmp = Float64(Float64(x - z) / Float64(t * 2.0)); 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 <= -0.0037) || ~((z <= 2.3e+24))) tmp = (x - z) / (t * 2.0); else tmp = ((y + x) / t) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.0037], N[Not[LessEqual[z, 2.3e+24]], $MachinePrecision]], N[(N[(x - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y + x), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0037 \lor \neg \left(z \leq 2.3 \cdot 10^{+24}\right):\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y + x}{t} \cdot 0.5\\
\end{array}
\end{array}
if z < -0.0037000000000000002 or 2.2999999999999999e24 < z Initial program 100.0%
Taylor expanded in y around 0
lower--.f6486.1
Applied rewrites86.1%
if -0.0037000000000000002 < z < 2.2999999999999999e24Initial program 99.3%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6494.3
Applied rewrites94.3%
Final simplification90.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.004) (not (<= z 2.9e+24))) (* (/ 0.5 t) (- x z)) (* (/ (+ y x) t) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.004) || !(z <= 2.9e+24)) {
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 ((z <= (-0.004d0)) .or. (.not. (z <= 2.9d+24))) 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 ((z <= -0.004) || !(z <= 2.9e+24)) {
tmp = (0.5 / t) * (x - z);
} else {
tmp = ((y + x) / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.004) or not (z <= 2.9e+24): 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 ((z <= -0.004) || !(z <= 2.9e+24)) 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 ((z <= -0.004) || ~((z <= 2.9e+24))) tmp = (0.5 / t) * (x - z); else tmp = ((y + x) / t) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.004], N[Not[LessEqual[z, 2.9e+24]], $MachinePrecision]], 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}\;z \leq -0.004 \lor \neg \left(z \leq 2.9 \cdot 10^{+24}\right):\\
\;\;\;\;\frac{0.5}{t} \cdot \left(x - z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y + x}{t} \cdot 0.5\\
\end{array}
\end{array}
if z < -0.0040000000000000001 or 2.89999999999999979e24 < z 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 y around 0
lower--.f6486.6
Applied rewrites86.6%
if -0.0040000000000000001 < z < 2.89999999999999979e24Initial program 99.3%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6494.4
Applied rewrites94.4%
Final simplification91.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.55e+134) (not (<= z 2.15e+56))) (/ (* -0.5 z) t) (* (/ (+ y x) t) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.55e+134) || !(z <= 2.15e+56)) {
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 <= (-3.55d+134)) .or. (.not. (z <= 2.15d+56))) 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 <= -3.55e+134) || !(z <= 2.15e+56)) {
tmp = (-0.5 * z) / t;
} else {
tmp = ((y + x) / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.55e+134) or not (z <= 2.15e+56): 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 <= -3.55e+134) || !(z <= 2.15e+56)) 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 <= -3.55e+134) || ~((z <= 2.15e+56))) 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, -3.55e+134], N[Not[LessEqual[z, 2.15e+56]], $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 -3.55 \cdot 10^{+134} \lor \neg \left(z \leq 2.15 \cdot 10^{+56}\right):\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y + x}{t} \cdot 0.5\\
\end{array}
\end{array}
if z < -3.54999999999999995e134 or 2.1500000000000002e56 < z 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-/.f6485.7
Applied rewrites85.7%
Applied rewrites85.9%
if -3.54999999999999995e134 < z < 2.1500000000000002e56Initial program 99.5%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6488.0
Applied rewrites88.0%
Final simplification87.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.0075) (not (<= z 2.2e+24))) (* (/ -0.5 t) z) (* (/ y t) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.0075) || !(z <= 2.2e+24)) {
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 ((z <= (-0.0075d0)) .or. (.not. (z <= 2.2d+24))) 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 ((z <= -0.0075) || !(z <= 2.2e+24)) {
tmp = (-0.5 / t) * z;
} else {
tmp = (y / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.0075) or not (z <= 2.2e+24): tmp = (-0.5 / t) * z else: tmp = (y / t) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.0075) || !(z <= 2.2e+24)) 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 ((z <= -0.0075) || ~((z <= 2.2e+24))) tmp = (-0.5 / t) * z; else tmp = (y / t) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.0075], N[Not[LessEqual[z, 2.2e+24]], $MachinePrecision]], N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0075 \lor \neg \left(z \leq 2.2 \cdot 10^{+24}\right):\\
\;\;\;\;\frac{-0.5}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if z < -0.0074999999999999997 or 2.20000000000000002e24 < z 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-/.f6473.3
Applied rewrites73.3%
if -0.0074999999999999997 < z < 2.20000000000000002e24Initial program 99.3%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6494.3
Applied rewrites94.3%
Taylor expanded in x around 0
Applied rewrites53.7%
Final simplification62.0%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -4e-184) (* (/ 0.5 t) (- x z)) (/ (- y z) (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -4e-184) {
tmp = (0.5 / t) * (x - z);
} 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-184)) then
tmp = (0.5d0 / t) * (x - z)
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-184) {
tmp = (0.5 / t) * (x - z);
} else {
tmp = (y - z) / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -4e-184: tmp = (0.5 / t) * (x - z) else: tmp = (y - z) / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -4e-184) tmp = Float64(Float64(0.5 / t) * Float64(x - z)); 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-184) tmp = (0.5 / t) * (x - z); else tmp = (y - z) / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -4e-184], N[(N[(0.5 / t), $MachinePrecision] * N[(x - z), $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^{-184}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(x - z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t \cdot 2}\\
\end{array}
\end{array}
if (+.f64 x y) < -4.0000000000000002e-184Initial program 99.2%
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--.f6460.3
Applied rewrites60.3%
if -4.0000000000000002e-184 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0
lower--.f6468.6
Applied rewrites68.6%
Final simplification64.6%
(FPCore (x y z t) :precision binary64 (* (/ y t) 0.5))
double code(double x, double y, double z, double t) {
return (y / t) * 0.5;
}
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 / t) * 0.5d0
end function
public static double code(double x, double y, double z, double t) {
return (y / t) * 0.5;
}
def code(x, y, z, t): return (y / t) * 0.5
function code(x, y, z, t) return Float64(Float64(y / t) * 0.5) end
function tmp = code(x, y, z, t) tmp = (y / t) * 0.5; end
code[x_, y_, z_, t_] := N[(N[(y / t), $MachinePrecision] * 0.5), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{t} \cdot 0.5
\end{array}
Initial program 99.6%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6469.4
Applied rewrites69.4%
Taylor expanded in x around 0
Applied rewrites40.4%
herbie shell --seed 2024296
(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)))