
(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 10 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) z) (* t 2.0)) -2e-301) (* x (/ 0.5 t)) (* (/ y t) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if ((((x + y) - z) / (t * 2.0)) <= -2e-301) {
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) / (t * 2.0d0)) <= (-2d-301)) 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) / (t * 2.0)) <= -2e-301) {
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) / (t * 2.0)) <= -2e-301: 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(Float64(x + y) - z) / Float64(t * 2.0)) <= -2e-301) 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) / (t * 2.0)) <= -2e-301) 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[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], -2e-301], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\left(x + y\right) - z}{t \cdot 2} \leq -2 \cdot 10^{-301}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 x y) z) (*.f64 t #s(literal 2 binary64))) < -2.00000000000000013e-301Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6438.7
Applied rewrites38.7%
Applied rewrites38.6%
if -2.00000000000000013e-301 < (/.f64 (-.f64 (+.f64 x y) z) (*.f64 t #s(literal 2 binary64))) Initial program 100.0%
Taylor expanded in z around 0
div-add-revN/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6467.1
Applied rewrites67.1%
Taylor expanded in x around 0
Applied rewrites28.8%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -1e-68) (* (/ x t) 0.5) (if (<= (+ x y) 2e+38) (/ (* -0.5 z) t) (* (/ y t) 0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e-68) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 2e+38) {
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) <= (-1d-68)) then
tmp = (x / t) * 0.5d0
else if ((x + y) <= 2d+38) 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) <= -1e-68) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 2e+38) {
tmp = (-0.5 * z) / t;
} else {
tmp = (y / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -1e-68: tmp = (x / t) * 0.5 elif (x + y) <= 2e+38: 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) <= -1e-68) tmp = Float64(Float64(x / t) * 0.5); elseif (Float64(x + y) <= 2e+38) 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) <= -1e-68) tmp = (x / t) * 0.5; elseif ((x + y) <= 2e+38) 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], -1e-68], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 2e+38], 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 -1 \cdot 10^{-68}:\\
\;\;\;\;\frac{x}{t} \cdot 0.5\\
\mathbf{elif}\;x + y \leq 2 \cdot 10^{+38}:\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -1.00000000000000007e-68Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6447.2
Applied rewrites47.2%
if -1.00000000000000007e-68 < (+.f64 x y) < 1.99999999999999995e38Initial program 100.0%
Taylor expanded in z around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6475.9
Applied rewrites75.9%
Applied rewrites76.2%
if 1.99999999999999995e38 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
div-add-revN/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6480.7
Applied rewrites80.7%
Taylor expanded in x around 0
Applied rewrites40.7%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -1e-68) (* (/ x t) 0.5) (if (<= (+ x y) 2e+38) (* (/ -0.5 t) z) (* (/ y t) 0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e-68) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 2e+38) {
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) <= (-1d-68)) then
tmp = (x / t) * 0.5d0
else if ((x + y) <= 2d+38) 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) <= -1e-68) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 2e+38) {
tmp = (-0.5 / t) * z;
} else {
tmp = (y / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -1e-68: tmp = (x / t) * 0.5 elif (x + y) <= 2e+38: 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) <= -1e-68) tmp = Float64(Float64(x / t) * 0.5); elseif (Float64(x + y) <= 2e+38) 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) <= -1e-68) tmp = (x / t) * 0.5; elseif ((x + y) <= 2e+38) 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], -1e-68], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 2e+38], 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 -1 \cdot 10^{-68}:\\
\;\;\;\;\frac{x}{t} \cdot 0.5\\
\mathbf{elif}\;x + y \leq 2 \cdot 10^{+38}:\\
\;\;\;\;\frac{-0.5}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -1.00000000000000007e-68Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6447.2
Applied rewrites47.2%
if -1.00000000000000007e-68 < (+.f64 x y) < 1.99999999999999995e38Initial program 100.0%
Taylor expanded in z around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6475.9
Applied rewrites75.9%
if 1.99999999999999995e38 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
div-add-revN/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6480.7
Applied rewrites80.7%
Taylor expanded in x around 0
Applied rewrites40.7%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -1e-68) (* x (/ 0.5 t)) (if (<= (+ x y) 2e+38) (* (/ -0.5 t) z) (* (/ y t) 0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e-68) {
tmp = x * (0.5 / t);
} else if ((x + y) <= 2e+38) {
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) <= (-1d-68)) then
tmp = x * (0.5d0 / t)
else if ((x + y) <= 2d+38) 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) <= -1e-68) {
tmp = x * (0.5 / t);
} else if ((x + y) <= 2e+38) {
tmp = (-0.5 / t) * z;
} else {
tmp = (y / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -1e-68: tmp = x * (0.5 / t) elif (x + y) <= 2e+38: 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) <= -1e-68) tmp = Float64(x * Float64(0.5 / t)); elseif (Float64(x + y) <= 2e+38) 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) <= -1e-68) tmp = x * (0.5 / t); elseif ((x + y) <= 2e+38) 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], -1e-68], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 2e+38], 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 -1 \cdot 10^{-68}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\mathbf{elif}\;x + y \leq 2 \cdot 10^{+38}:\\
\;\;\;\;\frac{-0.5}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -1.00000000000000007e-68Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6447.2
Applied rewrites47.2%
Applied rewrites47.1%
if -1.00000000000000007e-68 < (+.f64 x y) < 1.99999999999999995e38Initial program 100.0%
Taylor expanded in z around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6475.9
Applied rewrites75.9%
if 1.99999999999999995e38 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
div-add-revN/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6480.7
Applied rewrites80.7%
Taylor expanded in x around 0
Applied rewrites40.7%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -1e-155) (/ (- x z) (+ t t)) (/ (- y z) (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e-155) {
tmp = (x - z) / (t + t);
} 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) <= (-1d-155)) then
tmp = (x - z) / (t + t)
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) <= -1e-155) {
tmp = (x - z) / (t + t);
} else {
tmp = (y - z) / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -1e-155: tmp = (x - z) / (t + t) else: tmp = (y - z) / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -1e-155) tmp = Float64(Float64(x - z) / Float64(t + t)); 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) <= -1e-155) tmp = (x - z) / (t + t); else tmp = (y - z) / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e-155], N[(N[(x - z), $MachinePrecision] / N[(t + t), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{-155}:\\
\;\;\;\;\frac{x - z}{t + t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t \cdot 2}\\
\end{array}
\end{array}
if (+.f64 x y) < -1.00000000000000001e-155Initial program 100.0%
Taylor expanded in y around 0
lower--.f6471.1
Applied rewrites71.1%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6471.1
Applied rewrites71.1%
if -1.00000000000000001e-155 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0
lower--.f6467.6
Applied rewrites67.6%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) 2e+38) (/ (- x z) (+ t t)) (* (/ (+ y x) t) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 2e+38) {
tmp = (x - z) / (t + 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 ((x + y) <= 2d+38) then
tmp = (x - z) / (t + 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 ((x + y) <= 2e+38) {
tmp = (x - z) / (t + t);
} else {
tmp = ((y + x) / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= 2e+38: tmp = (x - z) / (t + t) else: tmp = ((y + x) / t) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= 2e+38) tmp = Float64(Float64(x - z) / Float64(t + 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 ((x + y) <= 2e+38) tmp = (x - z) / (t + t); else tmp = ((y + x) / t) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], 2e+38], N[(N[(x - z), $MachinePrecision] / N[(t + t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y + x), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 2 \cdot 10^{+38}:\\
\;\;\;\;\frac{x - z}{t + t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y + x}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < 1.99999999999999995e38Initial program 100.0%
Taylor expanded in y around 0
lower--.f6475.9
Applied rewrites75.9%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6475.9
Applied rewrites75.9%
if 1.99999999999999995e38 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
div-add-revN/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6480.7
Applied rewrites80.7%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) 2e+38) (/ (- x z) (+ t t)) (* (/ 0.5 t) (+ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 2e+38) {
tmp = (x - z) / (t + t);
} else {
tmp = (0.5 / t) * (x + 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 ((x + y) <= 2d+38) then
tmp = (x - z) / (t + t)
else
tmp = (0.5d0 / t) * (x + y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 2e+38) {
tmp = (x - z) / (t + t);
} else {
tmp = (0.5 / t) * (x + y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= 2e+38: tmp = (x - z) / (t + t) else: tmp = (0.5 / t) * (x + y) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= 2e+38) tmp = Float64(Float64(x - z) / Float64(t + t)); else tmp = Float64(Float64(0.5 / t) * Float64(x + y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= 2e+38) tmp = (x - z) / (t + t); else tmp = (0.5 / t) * (x + y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], 2e+38], N[(N[(x - z), $MachinePrecision] / N[(t + t), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / t), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 2 \cdot 10^{+38}:\\
\;\;\;\;\frac{x - z}{t + t}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(x + y\right)\\
\end{array}
\end{array}
if (+.f64 x y) < 1.99999999999999995e38Initial program 100.0%
Taylor expanded in y around 0
lower--.f6475.9
Applied rewrites75.9%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6475.9
Applied rewrites75.9%
if 1.99999999999999995e38 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6421.9
Applied rewrites21.9%
Taylor expanded in z around 0
associate-*r/N/A
distribute-lft-inN/A
div-add-revN/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-outN/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-+.f6480.4
Applied rewrites80.4%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) 2e+38) (/ (- x z) (+ t t)) (* (/ y t) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 2e+38) {
tmp = (x - z) / (t + 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) <= 2d+38) then
tmp = (x - z) / (t + 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) <= 2e+38) {
tmp = (x - z) / (t + t);
} else {
tmp = (y / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= 2e+38: tmp = (x - z) / (t + t) else: tmp = (y / t) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= 2e+38) tmp = Float64(Float64(x - z) / Float64(t + 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) <= 2e+38) tmp = (x - z) / (t + t); else tmp = (y / t) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], 2e+38], N[(N[(x - z), $MachinePrecision] / N[(t + t), $MachinePrecision]), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 2 \cdot 10^{+38}:\\
\;\;\;\;\frac{x - z}{t + t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < 1.99999999999999995e38Initial program 100.0%
Taylor expanded in y around 0
lower--.f6475.9
Applied rewrites75.9%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6475.9
Applied rewrites75.9%
if 1.99999999999999995e38 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
div-add-revN/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6480.7
Applied rewrites80.7%
Taylor expanded in x around 0
Applied rewrites40.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-/.f6441.0
Applied rewrites41.0%
Applied rewrites40.9%
herbie shell --seed 2024338
(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)))