
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
(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) -1e+135) (* (/ x t) 0.5) (if (<= (+ y x) 1000.0) (/ (* -0.5 z) t) (* (/ y t) 0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= -1e+135) {
tmp = (x / t) * 0.5;
} else if ((y + x) <= 1000.0) {
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 ((y + x) <= (-1d+135)) then
tmp = (x / t) * 0.5d0
else if ((y + x) <= 1000.0d0) 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 ((y + x) <= -1e+135) {
tmp = (x / t) * 0.5;
} else if ((y + x) <= 1000.0) {
tmp = (-0.5 * z) / t;
} else {
tmp = (y / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y + x) <= -1e+135: tmp = (x / t) * 0.5 elif (y + x) <= 1000.0: tmp = (-0.5 * z) / t else: tmp = (y / t) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(y + x) <= -1e+135) tmp = Float64(Float64(x / t) * 0.5); elseif (Float64(y + x) <= 1000.0) 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 ((y + x) <= -1e+135) tmp = (x / t) * 0.5; elseif ((y + x) <= 1000.0) tmp = (-0.5 * z) / t; else tmp = (y / t) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(y + x), $MachinePrecision], -1e+135], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(y + x), $MachinePrecision], 1000.0], N[(N[(-0.5 * z), $MachinePrecision] / t), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * 0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + x \leq -1 \cdot 10^{+135}:\\
\;\;\;\;\frac{x}{t} \cdot 0.5\\
\mathbf{elif}\;y + x \leq 1000:\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -9.99999999999999962e134Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6451.7
Applied rewrites51.7%
if -9.99999999999999962e134 < (+.f64 x y) < 1e3Initial 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.9
Applied rewrites68.9%
Applied rewrites69.1%
if 1e3 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-outN/A
associate-*l*N/A
associate-*l*N/A
distribute-lft-outN/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
*-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites89.6%
Taylor expanded in x around 0
Applied rewrites57.3%
Final simplification60.9%
(FPCore (x y z t) :precision binary64 (if (<= (+ y x) -1e+135) (* (/ x t) 0.5) (if (<= (+ y x) 1000.0) (* (/ -0.5 t) z) (* (/ y t) 0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= -1e+135) {
tmp = (x / t) * 0.5;
} else if ((y + x) <= 1000.0) {
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 ((y + x) <= (-1d+135)) then
tmp = (x / t) * 0.5d0
else if ((y + x) <= 1000.0d0) 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 ((y + x) <= -1e+135) {
tmp = (x / t) * 0.5;
} else if ((y + x) <= 1000.0) {
tmp = (-0.5 / t) * z;
} else {
tmp = (y / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y + x) <= -1e+135: tmp = (x / t) * 0.5 elif (y + x) <= 1000.0: tmp = (-0.5 / t) * z else: tmp = (y / t) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(y + x) <= -1e+135) tmp = Float64(Float64(x / t) * 0.5); elseif (Float64(y + x) <= 1000.0) 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 ((y + x) <= -1e+135) tmp = (x / t) * 0.5; elseif ((y + x) <= 1000.0) tmp = (-0.5 / t) * z; else tmp = (y / t) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(y + x), $MachinePrecision], -1e+135], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(y + x), $MachinePrecision], 1000.0], N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * 0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + x \leq -1 \cdot 10^{+135}:\\
\;\;\;\;\frac{x}{t} \cdot 0.5\\
\mathbf{elif}\;y + x \leq 1000:\\
\;\;\;\;\frac{-0.5}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -9.99999999999999962e134Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6451.7
Applied rewrites51.7%
if -9.99999999999999962e134 < (+.f64 x y) < 1e3Initial 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.9
Applied rewrites68.9%
if 1e3 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-outN/A
associate-*l*N/A
associate-*l*N/A
distribute-lft-outN/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
*-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites89.6%
Taylor expanded in x around 0
Applied rewrites57.3%
Final simplification60.8%
(FPCore (x y z t) :precision binary64 (if (<= (+ y x) -1e+135) (* (/ 0.5 t) x) (if (<= (+ y x) 1000.0) (* (/ -0.5 t) z) (* (/ y t) 0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= -1e+135) {
tmp = (0.5 / t) * x;
} else if ((y + x) <= 1000.0) {
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 ((y + x) <= (-1d+135)) then
tmp = (0.5d0 / t) * x
else if ((y + x) <= 1000.0d0) 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 ((y + x) <= -1e+135) {
tmp = (0.5 / t) * x;
} else if ((y + x) <= 1000.0) {
tmp = (-0.5 / t) * z;
} else {
tmp = (y / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y + x) <= -1e+135: tmp = (0.5 / t) * x elif (y + x) <= 1000.0: tmp = (-0.5 / t) * z else: tmp = (y / t) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(y + x) <= -1e+135) tmp = Float64(Float64(0.5 / t) * x); elseif (Float64(y + x) <= 1000.0) 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 ((y + x) <= -1e+135) tmp = (0.5 / t) * x; elseif ((y + x) <= 1000.0) tmp = (-0.5 / t) * z; else tmp = (y / t) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(y + x), $MachinePrecision], -1e+135], N[(N[(0.5 / t), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[N[(y + x), $MachinePrecision], 1000.0], N[(N[(-0.5 / t), $MachinePrecision] * z), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * 0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + x \leq -1 \cdot 10^{+135}:\\
\;\;\;\;\frac{0.5}{t} \cdot x\\
\mathbf{elif}\;y + x \leq 1000:\\
\;\;\;\;\frac{-0.5}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -9.99999999999999962e134Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6451.7
Applied rewrites51.7%
Applied rewrites51.6%
if -9.99999999999999962e134 < (+.f64 x y) < 1e3Initial 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.9
Applied rewrites68.9%
if 1e3 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-outN/A
associate-*l*N/A
associate-*l*N/A
distribute-lft-outN/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
*-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites89.6%
Taylor expanded in x around 0
Applied rewrites57.3%
Final simplification60.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- y z) (/ 0.5 t)))) (if (<= z -2.4e+96) t_1 (if (<= z 4.2e-66) (* (/ (+ y x) t) 0.5) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * (0.5 / t);
double tmp;
if (z <= -2.4e+96) {
tmp = t_1;
} else if (z <= 4.2e-66) {
tmp = ((y + x) / t) * 0.5;
} 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 = (y - z) * (0.5d0 / t)
if (z <= (-2.4d+96)) then
tmp = t_1
else if (z <= 4.2d-66) then
tmp = ((y + x) / t) * 0.5d0
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 = (y - z) * (0.5 / t);
double tmp;
if (z <= -2.4e+96) {
tmp = t_1;
} else if (z <= 4.2e-66) {
tmp = ((y + x) / t) * 0.5;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - z) * (0.5 / t) tmp = 0 if z <= -2.4e+96: tmp = t_1 elif z <= 4.2e-66: tmp = ((y + x) / t) * 0.5 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * Float64(0.5 / t)) tmp = 0.0 if (z <= -2.4e+96) tmp = t_1; elseif (z <= 4.2e-66) tmp = Float64(Float64(Float64(y + x) / t) * 0.5); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - z) * (0.5 / t); tmp = 0.0; if (z <= -2.4e+96) tmp = t_1; elseif (z <= 4.2e-66) tmp = ((y + x) / t) * 0.5; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.4e+96], t$95$1, If[LessEqual[z, 4.2e-66], N[(N[(N[(y + x), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot \frac{0.5}{t}\\
\mathbf{if}\;z \leq -2.4 \cdot 10^{+96}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-66}:\\
\;\;\;\;\frac{y + x}{t} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.39999999999999993e96 or 4.2000000000000001e-66 < 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 x around 0
lower--.f6487.0
Applied rewrites87.0%
if -2.39999999999999993e96 < z < 4.2000000000000001e-66Initial program 100.0%
Taylor expanded in z around 0
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-outN/A
associate-*l*N/A
associate-*l*N/A
distribute-lft-outN/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
*-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.0%
Final simplification90.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ (* -0.5 z) t))) (if (<= z -3.8e+128) t_1 (if (<= z 8.5e+157) (* (/ (+ y x) t) 0.5) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (-0.5 * z) / t;
double tmp;
if (z <= -3.8e+128) {
tmp = t_1;
} else if (z <= 8.5e+157) {
tmp = ((y + x) / t) * 0.5;
} 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 <= (-3.8d+128)) then
tmp = t_1
else if (z <= 8.5d+157) then
tmp = ((y + x) / t) * 0.5d0
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 <= -3.8e+128) {
tmp = t_1;
} else if (z <= 8.5e+157) {
tmp = ((y + x) / t) * 0.5;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (-0.5 * z) / t tmp = 0 if z <= -3.8e+128: tmp = t_1 elif z <= 8.5e+157: tmp = ((y + x) / t) * 0.5 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 <= -3.8e+128) tmp = t_1; elseif (z <= 8.5e+157) tmp = Float64(Float64(Float64(y + x) / t) * 0.5); 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 <= -3.8e+128) tmp = t_1; elseif (z <= 8.5e+157) tmp = ((y + x) / t) * 0.5; 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, -3.8e+128], t$95$1, If[LessEqual[z, 8.5e+157], N[(N[(N[(y + x), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-0.5 \cdot z}{t}\\
\mathbf{if}\;z \leq -3.8 \cdot 10^{+128}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+157}:\\
\;\;\;\;\frac{y + x}{t} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.7999999999999999e128 or 8.4999999999999998e157 < 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-/.f6481.7
Applied rewrites81.7%
Applied rewrites81.9%
if -3.7999999999999999e128 < z < 8.4999999999999998e157Initial program 100.0%
Taylor expanded in z around 0
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-outN/A
associate-*l*N/A
associate-*l*N/A
distribute-lft-outN/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
*-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites84.3%
(FPCore (x y z t) :precision binary64 (if (<= (+ y x) -1e-113) (/ (- 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-113) {
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-113)) 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-113) {
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-113: 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-113) 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-113) 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-113], 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^{-113}:\\
\;\;\;\;\frac{x - z}{2 \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{2 \cdot t}\\
\end{array}
\end{array}
if (+.f64 x y) < -9.99999999999999979e-114Initial program 100.0%
Taylor expanded in y around 0
lower--.f6472.9
Applied rewrites72.9%
if -9.99999999999999979e-114 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0
lower--.f6476.5
Applied rewrites76.5%
Final simplification75.0%
(FPCore (x y z t) :precision binary64 (if (<= (+ y x) -2e-184) (/ (- x z) (* 2.0 t)) (* (- y z) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y + x) <= -2e-184) {
tmp = (x - z) / (2.0 * t);
} else {
tmp = (y - z) * (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) <= (-2d-184)) then
tmp = (x - z) / (2.0d0 * t)
else
tmp = (y - z) * (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) <= -2e-184) {
tmp = (x - z) / (2.0 * t);
} else {
tmp = (y - z) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y + x) <= -2e-184: tmp = (x - z) / (2.0 * t) else: tmp = (y - z) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(y + x) <= -2e-184) tmp = Float64(Float64(x - z) / Float64(2.0 * t)); else tmp = Float64(Float64(y - z) * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y + x) <= -2e-184) tmp = (x - z) / (2.0 * t); else tmp = (y - z) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(y + x), $MachinePrecision], -2e-184], N[(N[(x - z), $MachinePrecision] / N[(2.0 * t), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + x \leq -2 \cdot 10^{-184}:\\
\;\;\;\;\frac{x - z}{2 \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < -2.0000000000000001e-184Initial program 100.0%
Taylor expanded in y around 0
lower--.f6475.6
Applied rewrites75.6%
if -2.0000000000000001e-184 < (+.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.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
Applied rewrites99.6%
Taylor expanded in x around 0
lower--.f6474.2
Applied rewrites74.2%
Final simplification74.8%
(FPCore (x y z t) :precision binary64 (if (<= (- (+ y x) z) -1e-161) (* (/ 0.5 t) x) (* (/ y t) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if (((y + x) - z) <= -1e-161) {
tmp = (0.5 / t) * x;
} 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 (((y + x) - z) <= (-1d-161)) then
tmp = (0.5d0 / t) * x
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 (((y + x) - z) <= -1e-161) {
tmp = (0.5 / t) * x;
} else {
tmp = (y / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((y + x) - z) <= -1e-161: tmp = (0.5 / t) * x else: tmp = (y / t) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(y + x) - z) <= -1e-161) tmp = Float64(Float64(0.5 / t) * x); else tmp = Float64(Float64(y / t) * 0.5); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((y + x) - z) <= -1e-161) tmp = (0.5 / t) * x; else tmp = (y / t) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(y + x), $MachinePrecision] - z), $MachinePrecision], -1e-161], N[(N[(0.5 / t), $MachinePrecision] * x), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(y + x\right) - z \leq -1 \cdot 10^{-161}:\\
\;\;\;\;\frac{0.5}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) z) < -1.00000000000000003e-161Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6439.2
Applied rewrites39.2%
Applied rewrites39.1%
if -1.00000000000000003e-161 < (-.f64 (+.f64 x y) z) Initial program 100.0%
Taylor expanded in z around 0
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-outN/A
associate-*l*N/A
associate-*l*N/A
distribute-lft-outN/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
*-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites66.1%
Taylor expanded in x around 0
Applied rewrites42.8%
Final simplification41.2%
(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.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.6
Applied rewrites99.6%
(FPCore (x y z t) :precision binary64 (* (/ 0.5 t) x))
double code(double x, double y, double z, double t) {
return (0.5 / t) * x;
}
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) * x
end function
public static double code(double x, double y, double z, double t) {
return (0.5 / t) * x;
}
def code(x, y, z, t): return (0.5 / t) * x
function code(x, y, z, t) return Float64(Float64(0.5 / t) * x) end
function tmp = code(x, y, z, t) tmp = (0.5 / t) * x; end
code[x_, y_, z_, t_] := N[(N[(0.5 / t), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5}{t} \cdot x
\end{array}
Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6433.6
Applied rewrites33.6%
Applied rewrites33.5%
Final simplification33.5%
herbie shell --seed 2024304
(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)))