
(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 (/ (- (+ y x) z) (* 2.0 t)))
double code(double x, double y, double z, double t) {
return ((y + x) - z) / (2.0 * t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((y + x) - z) / (2.0d0 * t)
end function
public static double code(double x, double y, double z, double t) {
return ((y + x) - z) / (2.0 * t);
}
def code(x, y, z, t): return ((y + x) - z) / (2.0 * t)
function code(x, y, z, t) return Float64(Float64(Float64(y + x) - z) / Float64(2.0 * t)) end
function tmp = code(x, y, z, t) tmp = ((y + x) - z) / (2.0 * t); end
code[x_, y_, z_, t_] := N[(N[(N[(y + x), $MachinePrecision] - z), $MachinePrecision] / N[(2.0 * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(y + x\right) - z}{2 \cdot t}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (if (<= (+ y x) -2e-94) (/ (* 0.5 x) t) (if (<= (+ y x) 200000000.0) (/ (* -0.5 z) t) (/ (* 0.5 y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= -2e-94) {
tmp = (0.5 * x) / t;
} else if ((y + x) <= 200000000.0) {
tmp = (-0.5 * z) / t;
} else {
tmp = (0.5 * y) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y + x) <= (-2d-94)) then
tmp = (0.5d0 * x) / t
else if ((y + x) <= 200000000.0d0) then
tmp = ((-0.5d0) * z) / t
else
tmp = (0.5d0 * y) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= -2e-94) {
tmp = (0.5 * x) / t;
} else if ((y + x) <= 200000000.0) {
tmp = (-0.5 * z) / t;
} else {
tmp = (0.5 * y) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y + x) <= -2e-94: tmp = (0.5 * x) / t elif (y + x) <= 200000000.0: tmp = (-0.5 * z) / t else: tmp = (0.5 * y) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(y + x) <= -2e-94) tmp = Float64(Float64(0.5 * x) / t); elseif (Float64(y + x) <= 200000000.0) tmp = Float64(Float64(-0.5 * z) / t); else tmp = Float64(Float64(0.5 * y) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y + x) <= -2e-94) tmp = (0.5 * x) / t; elseif ((y + x) <= 200000000.0) tmp = (-0.5 * z) / t; else tmp = (0.5 * y) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(y + x), $MachinePrecision], -2e-94], N[(N[(0.5 * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[N[(y + x), $MachinePrecision], 200000000.0], N[(N[(-0.5 * z), $MachinePrecision] / t), $MachinePrecision], N[(N[(0.5 * y), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + x \leq -2 \cdot 10^{-94}:\\
\;\;\;\;\frac{0.5 \cdot x}{t}\\
\mathbf{elif}\;y + x \leq 200000000:\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot y}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < -1.9999999999999999e-94Initial program 99.9%
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-/.f6439.2
Applied rewrites39.2%
Applied rewrites39.3%
if -1.9999999999999999e-94 < (+.f64 x y) < 2e8Initial 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.5
Applied rewrites80.5%
Applied rewrites80.7%
if 2e8 < (+.f64 x y) Initial program 100.0%
Taylor expanded in y around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6441.6
Applied rewrites41.6%
Applied rewrites41.8%
Final simplification48.7%
(FPCore (x y z t) :precision binary64 (if (<= (+ y x) -2e-94) (/ (* 0.5 x) t) (if (<= (+ y x) 200000000.0) (/ (* -0.5 z) t) (* (/ 0.5 t) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= -2e-94) {
tmp = (0.5 * x) / t;
} else if ((y + x) <= 200000000.0) {
tmp = (-0.5 * z) / t;
} else {
tmp = (0.5 / t) * y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y + x) <= (-2d-94)) then
tmp = (0.5d0 * x) / t
else if ((y + x) <= 200000000.0d0) then
tmp = ((-0.5d0) * z) / t
else
tmp = (0.5d0 / t) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= -2e-94) {
tmp = (0.5 * x) / t;
} else if ((y + x) <= 200000000.0) {
tmp = (-0.5 * z) / t;
} else {
tmp = (0.5 / t) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y + x) <= -2e-94: tmp = (0.5 * x) / t elif (y + x) <= 200000000.0: tmp = (-0.5 * z) / t else: tmp = (0.5 / t) * y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(y + x) <= -2e-94) tmp = Float64(Float64(0.5 * x) / t); elseif (Float64(y + x) <= 200000000.0) tmp = Float64(Float64(-0.5 * z) / t); else tmp = Float64(Float64(0.5 / t) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y + x) <= -2e-94) tmp = (0.5 * x) / t; elseif ((y + x) <= 200000000.0) tmp = (-0.5 * z) / t; else tmp = (0.5 / t) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(y + x), $MachinePrecision], -2e-94], N[(N[(0.5 * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[N[(y + x), $MachinePrecision], 200000000.0], N[(N[(-0.5 * z), $MachinePrecision] / t), $MachinePrecision], N[(N[(0.5 / t), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + x \leq -2 \cdot 10^{-94}:\\
\;\;\;\;\frac{0.5 \cdot x}{t}\\
\mathbf{elif}\;y + x \leq 200000000:\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot y\\
\end{array}
\end{array}
if (+.f64 x y) < -1.9999999999999999e-94Initial program 99.9%
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-/.f6439.2
Applied rewrites39.2%
Applied rewrites39.3%
if -1.9999999999999999e-94 < (+.f64 x y) < 2e8Initial 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.5
Applied rewrites80.5%
Applied rewrites80.7%
if 2e8 < (+.f64 x y) Initial program 100.0%
Taylor expanded in y around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6441.6
Applied rewrites41.6%
Final simplification48.7%
(FPCore (x y z t) :precision binary64 (if (<= (+ y x) -2e-94) (* (/ 0.5 t) x) (if (<= (+ y x) 200000000.0) (/ (* -0.5 z) t) (* (/ 0.5 t) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= -2e-94) {
tmp = (0.5 / t) * x;
} else if ((y + x) <= 200000000.0) {
tmp = (-0.5 * z) / t;
} else {
tmp = (0.5 / t) * y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y + x) <= (-2d-94)) then
tmp = (0.5d0 / t) * x
else if ((y + x) <= 200000000.0d0) then
tmp = ((-0.5d0) * z) / t
else
tmp = (0.5d0 / t) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= -2e-94) {
tmp = (0.5 / t) * x;
} else if ((y + x) <= 200000000.0) {
tmp = (-0.5 * z) / t;
} else {
tmp = (0.5 / t) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y + x) <= -2e-94: tmp = (0.5 / t) * x elif (y + x) <= 200000000.0: tmp = (-0.5 * z) / t else: tmp = (0.5 / t) * y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(y + x) <= -2e-94) tmp = Float64(Float64(0.5 / t) * x); elseif (Float64(y + x) <= 200000000.0) tmp = Float64(Float64(-0.5 * z) / t); else tmp = Float64(Float64(0.5 / t) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y + x) <= -2e-94) tmp = (0.5 / t) * x; elseif ((y + x) <= 200000000.0) tmp = (-0.5 * z) / t; else tmp = (0.5 / t) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(y + x), $MachinePrecision], -2e-94], N[(N[(0.5 / t), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[N[(y + x), $MachinePrecision], 200000000.0], N[(N[(-0.5 * z), $MachinePrecision] / t), $MachinePrecision], N[(N[(0.5 / t), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + x \leq -2 \cdot 10^{-94}:\\
\;\;\;\;\frac{0.5}{t} \cdot x\\
\mathbf{elif}\;y + x \leq 200000000:\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot y\\
\end{array}
\end{array}
if (+.f64 x y) < -1.9999999999999999e-94Initial program 99.9%
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-/.f6439.2
Applied rewrites39.2%
if -1.9999999999999999e-94 < (+.f64 x y) < 2e8Initial 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.5
Applied rewrites80.5%
Applied rewrites80.7%
if 2e8 < (+.f64 x y) Initial program 100.0%
Taylor expanded in y around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6441.6
Applied rewrites41.6%
Final simplification48.7%
(FPCore (x y z t) :precision binary64 (if (<= (+ y x) -2e-94) (* (/ 0.5 t) x) (if (<= (+ y x) 200000000.0) (* (/ -0.5 t) z) (* (/ 0.5 t) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= -2e-94) {
tmp = (0.5 / t) * x;
} else if ((y + x) <= 200000000.0) {
tmp = (-0.5 / t) * z;
} else {
tmp = (0.5 / t) * y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y + x) <= (-2d-94)) then
tmp = (0.5d0 / t) * x
else if ((y + x) <= 200000000.0d0) then
tmp = ((-0.5d0) / t) * z
else
tmp = (0.5d0 / t) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= -2e-94) {
tmp = (0.5 / t) * x;
} else if ((y + x) <= 200000000.0) {
tmp = (-0.5 / t) * z;
} else {
tmp = (0.5 / t) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y + x) <= -2e-94: tmp = (0.5 / t) * x elif (y + x) <= 200000000.0: tmp = (-0.5 / t) * z else: tmp = (0.5 / t) * y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(y + x) <= -2e-94) tmp = Float64(Float64(0.5 / t) * x); elseif (Float64(y + x) <= 200000000.0) tmp = Float64(Float64(-0.5 / t) * z); else tmp = Float64(Float64(0.5 / t) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y + x) <= -2e-94) tmp = (0.5 / t) * x; elseif ((y + x) <= 200000000.0) tmp = (-0.5 / t) * z; else tmp = (0.5 / t) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(y + x), $MachinePrecision], -2e-94], N[(N[(0.5 / t), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[N[(y + x), $MachinePrecision], 200000000.0], N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision], N[(N[(0.5 / t), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + x \leq -2 \cdot 10^{-94}:\\
\;\;\;\;\frac{0.5}{t} \cdot x\\
\mathbf{elif}\;y + x \leq 200000000:\\
\;\;\;\;\frac{-0.5}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot y\\
\end{array}
\end{array}
if (+.f64 x y) < -1.9999999999999999e-94Initial program 99.9%
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-/.f6439.2
Applied rewrites39.2%
if -1.9999999999999999e-94 < (+.f64 x y) < 2e8Initial 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.5
Applied rewrites80.5%
if 2e8 < (+.f64 x y) Initial program 100.0%
Taylor expanded in y around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6441.6
Applied rewrites41.6%
Final simplification48.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ (* -0.5 z) t))) (if (<= z -1.25e+93) t_1 (if (<= z 2.3e+104) (* (+ y x) (/ 0.5 t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (-0.5 * z) / t;
double tmp;
if (z <= -1.25e+93) {
tmp = t_1;
} else if (z <= 2.3e+104) {
tmp = (y + x) * (0.5 / t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = ((-0.5d0) * z) / t
if (z <= (-1.25d+93)) then
tmp = t_1
else if (z <= 2.3d+104) then
tmp = (y + x) * (0.5d0 / t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (-0.5 * z) / t;
double tmp;
if (z <= -1.25e+93) {
tmp = t_1;
} else if (z <= 2.3e+104) {
tmp = (y + x) * (0.5 / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (-0.5 * z) / t tmp = 0 if z <= -1.25e+93: tmp = t_1 elif z <= 2.3e+104: tmp = (y + x) * (0.5 / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-0.5 * z) / t) tmp = 0.0 if (z <= -1.25e+93) tmp = t_1; elseif (z <= 2.3e+104) tmp = Float64(Float64(y + x) * Float64(0.5 / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (-0.5 * z) / t; tmp = 0.0; if (z <= -1.25e+93) tmp = t_1; elseif (z <= 2.3e+104) tmp = (y + x) * (0.5 / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(-0.5 * z), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[z, -1.25e+93], t$95$1, If[LessEqual[z, 2.3e+104], N[(N[(y + x), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-0.5 \cdot z}{t}\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{+93}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+104}:\\
\;\;\;\;\left(y + x\right) \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.25e93 or 2.29999999999999985e104 < 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.5
Applied rewrites85.5%
Applied rewrites85.8%
if -1.25e93 < z < 2.29999999999999985e104Initial 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 z around 0
+-commutativeN/A
lower-+.f6490.6
Applied rewrites90.6%
Final simplification89.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ -0.5 t) z))) (if (<= z -1.15e+84) t_1 (if (<= z 6.8e+91) (* (/ 0.5 t) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (-0.5 / t) * z;
double tmp;
if (z <= -1.15e+84) {
tmp = t_1;
} else if (z <= 6.8e+91) {
tmp = (0.5 / t) * x;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = ((-0.5d0) / t) * z
if (z <= (-1.15d+84)) then
tmp = t_1
else if (z <= 6.8d+91) then
tmp = (0.5d0 / t) * x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (-0.5 / t) * z;
double tmp;
if (z <= -1.15e+84) {
tmp = t_1;
} else if (z <= 6.8e+91) {
tmp = (0.5 / t) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (-0.5 / t) * z tmp = 0 if z <= -1.15e+84: tmp = t_1 elif z <= 6.8e+91: tmp = (0.5 / t) * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-0.5 / t) * z) tmp = 0.0 if (z <= -1.15e+84) tmp = t_1; elseif (z <= 6.8e+91) tmp = Float64(Float64(0.5 / t) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (-0.5 / t) * z; tmp = 0.0; if (z <= -1.15e+84) tmp = t_1; elseif (z <= 6.8e+91) tmp = (0.5 / t) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -1.15e+84], t$95$1, If[LessEqual[z, 6.8e+91], N[(N[(0.5 / t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-0.5}{t} \cdot z\\
\mathbf{if}\;z \leq -1.15 \cdot 10^{+84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{+91}:\\
\;\;\;\;\frac{0.5}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.1499999999999999e84 or 6.8000000000000002e91 < 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-/.f6482.1
Applied rewrites82.1%
if -1.1499999999999999e84 < z < 6.8000000000000002e91Initial program 100.0%
Taylor expanded in x around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6448.3
Applied rewrites48.3%
(FPCore (x y z t) :precision binary64 (if (<= (+ y x) -1e-121) (/ (- x z) (* 2.0 t)) (/ (- y z) (* 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= -1e-121) {
tmp = (x - z) / (2.0 * t);
} else {
tmp = (y - z) / (2.0 * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y + x) <= (-1d-121)) then
tmp = (x - z) / (2.0d0 * t)
else
tmp = (y - z) / (2.0d0 * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= -1e-121) {
tmp = (x - z) / (2.0 * t);
} else {
tmp = (y - z) / (2.0 * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y + x) <= -1e-121: tmp = (x - z) / (2.0 * t) else: tmp = (y - z) / (2.0 * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(y + x) <= -1e-121) tmp = Float64(Float64(x - z) / Float64(2.0 * t)); else tmp = Float64(Float64(y - z) / Float64(2.0 * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y + x) <= -1e-121) tmp = (x - z) / (2.0 * t); else tmp = (y - z) / (2.0 * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(y + x), $MachinePrecision], -1e-121], N[(N[(x - z), $MachinePrecision] / N[(2.0 * t), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] / N[(2.0 * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + x \leq -1 \cdot 10^{-121}:\\
\;\;\;\;\frac{x - z}{2 \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{2 \cdot t}\\
\end{array}
\end{array}
if (+.f64 x y) < -9.9999999999999998e-122Initial program 99.9%
Taylor expanded in y around 0
lower--.f6466.8
Applied rewrites66.8%
if -9.9999999999999998e-122 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0
lower--.f6469.4
Applied rewrites69.4%
Final simplification68.2%
(FPCore (x y z t) :precision binary64 (if (<= (+ y x) 200000000.0) (/ (- x z) (* 2.0 t)) (/ (+ y x) (* 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= 200000000.0) {
tmp = (x - z) / (2.0 * t);
} else {
tmp = (y + x) / (2.0 * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y + x) <= 200000000.0d0) then
tmp = (x - z) / (2.0d0 * t)
else
tmp = (y + x) / (2.0d0 * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= 200000000.0) {
tmp = (x - z) / (2.0 * t);
} else {
tmp = (y + x) / (2.0 * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y + x) <= 200000000.0: tmp = (x - z) / (2.0 * t) else: tmp = (y + x) / (2.0 * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(y + x) <= 200000000.0) tmp = Float64(Float64(x - z) / Float64(2.0 * t)); else tmp = Float64(Float64(y + x) / Float64(2.0 * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y + x) <= 200000000.0) tmp = (x - z) / (2.0 * t); else tmp = (y + x) / (2.0 * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(y + x), $MachinePrecision], 200000000.0], N[(N[(x - z), $MachinePrecision] / N[(2.0 * t), $MachinePrecision]), $MachinePrecision], N[(N[(y + x), $MachinePrecision] / N[(2.0 * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + x \leq 200000000:\\
\;\;\;\;\frac{x - z}{2 \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y + x}{2 \cdot t}\\
\end{array}
\end{array}
if (+.f64 x y) < 2e8Initial program 100.0%
Taylor expanded in y around 0
lower--.f6472.9
Applied rewrites72.9%
if 2e8 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6486.6
Applied rewrites86.6%
Final simplification77.7%
(FPCore (x y z t) :precision binary64 (if (<= (+ y x) 200000000.0) (* (- x z) (/ 0.5 t)) (/ (+ y x) (* 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= 200000000.0) {
tmp = (x - z) * (0.5 / t);
} else {
tmp = (y + x) / (2.0 * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y + x) <= 200000000.0d0) then
tmp = (x - z) * (0.5d0 / t)
else
tmp = (y + x) / (2.0d0 * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= 200000000.0) {
tmp = (x - z) * (0.5 / t);
} else {
tmp = (y + x) / (2.0 * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y + x) <= 200000000.0: tmp = (x - z) * (0.5 / t) else: tmp = (y + x) / (2.0 * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(y + x) <= 200000000.0) tmp = Float64(Float64(x - z) * Float64(0.5 / t)); else tmp = Float64(Float64(y + x) / Float64(2.0 * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y + x) <= 200000000.0) tmp = (x - z) * (0.5 / t); else tmp = (y + x) / (2.0 * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(y + x), $MachinePrecision], 200000000.0], N[(N[(x - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(N[(y + x), $MachinePrecision] / N[(2.0 * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + x \leq 200000000:\\
\;\;\;\;\left(x - z\right) \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y + x}{2 \cdot t}\\
\end{array}
\end{array}
if (+.f64 x y) < 2e8Initial 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.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
Applied rewrites99.6%
Taylor expanded in y around 0
lower--.f6472.7
Applied rewrites72.7%
if 2e8 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6486.6
Applied rewrites86.6%
Final simplification77.6%
(FPCore (x y z t) :precision binary64 (if (<= (+ y x) 200000000.0) (* (- x z) (/ 0.5 t)) (* (+ y x) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= 200000000.0) {
tmp = (x - z) * (0.5 / t);
} else {
tmp = (y + x) * (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 ((y + x) <= 200000000.0d0) then
tmp = (x - z) * (0.5d0 / t)
else
tmp = (y + x) * (0.5d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= 200000000.0) {
tmp = (x - z) * (0.5 / t);
} else {
tmp = (y + x) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y + x) <= 200000000.0: tmp = (x - z) * (0.5 / t) else: tmp = (y + x) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(y + x) <= 200000000.0) tmp = Float64(Float64(x - z) * Float64(0.5 / t)); else tmp = Float64(Float64(y + x) * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y + x) <= 200000000.0) tmp = (x - z) * (0.5 / t); else tmp = (y + x) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(y + x), $MachinePrecision], 200000000.0], N[(N[(x - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(N[(y + x), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + x \leq 200000000:\\
\;\;\;\;\left(x - z\right) \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(y + x\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < 2e8Initial 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.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
Applied rewrites99.6%
Taylor expanded in y around 0
lower--.f6472.7
Applied rewrites72.7%
if 2e8 < (+.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 z around 0
+-commutativeN/A
lower-+.f6486.5
Applied rewrites86.5%
Final simplification77.5%
(FPCore (x y z t) :precision binary64 (* (- (+ y x) z) (/ 0.5 t)))
double code(double x, double y, double z, double t) {
return ((y + x) - z) * (0.5 / t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((y + x) - z) * (0.5d0 / t)
end function
public static double code(double x, double y, double z, double t) {
return ((y + x) - z) * (0.5 / t);
}
def code(x, y, z, t): return ((y + x) - z) * (0.5 / t)
function code(x, y, z, t) return Float64(Float64(Float64(y + x) - z) * Float64(0.5 / t)) end
function tmp = code(x, y, z, t) tmp = ((y + x) - z) * (0.5 / t); end
code[x_, y_, z_, t_] := N[(N[(N[(y + x), $MachinePrecision] - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(y + x\right) - z\right) \cdot \frac{0.5}{t}
\end{array}
Initial program 100.0%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-eval99.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (* (/ -0.5 t) z))
double code(double x, double y, double z, double t) {
return (-0.5 / t) * z;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((-0.5d0) / t) * z
end function
public static double code(double x, double y, double z, double t) {
return (-0.5 / t) * z;
}
def code(x, y, z, t): return (-0.5 / t) * z
function code(x, y, z, t) return Float64(Float64(-0.5 / t) * z) end
function tmp = code(x, y, z, t) tmp = (-0.5 / t) * z; end
code[x_, y_, z_, t_] := N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision]
\begin{array}{l}
\\
\frac{-0.5}{t} \cdot z
\end{array}
Initial program 100.0%
Taylor expanded in z around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6438.8
Applied rewrites38.8%
herbie shell --seed 2024244
(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)))