
(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) -50000000000.0) (* (/ x t) 0.5) (if (<= (+ x y) 2000000000000.0) (/ (* -0.5 z) t) (* (/ y t) 0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -50000000000.0) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 2000000000000.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 ((x + y) <= (-50000000000.0d0)) then
tmp = (x / t) * 0.5d0
else if ((x + y) <= 2000000000000.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 ((x + y) <= -50000000000.0) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 2000000000000.0) {
tmp = (-0.5 * z) / t;
} else {
tmp = (y / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -50000000000.0: tmp = (x / t) * 0.5 elif (x + y) <= 2000000000000.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(x + y) <= -50000000000.0) tmp = Float64(Float64(x / t) * 0.5); elseif (Float64(x + y) <= 2000000000000.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 ((x + y) <= -50000000000.0) tmp = (x / t) * 0.5; elseif ((x + y) <= 2000000000000.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[(x + y), $MachinePrecision], -50000000000.0], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 2000000000000.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}\;x + y \leq -50000000000:\\
\;\;\;\;\frac{x}{t} \cdot 0.5\\
\mathbf{elif}\;x + y \leq 2000000000000:\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -5e10Initial program 99.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6440.0
Applied rewrites40.0%
if -5e10 < (+.f64 x y) < 2e12Initial 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-/.f6467.9
Applied rewrites67.9%
Applied rewrites68.2%
if 2e12 < (+.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.1
Applied rewrites85.1%
Taylor expanded in x around 0
Applied rewrites44.1%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -50000000000.0) (* (/ x t) 0.5) (if (<= (+ x y) 2000000000000.0) (* (/ -0.5 t) z) (* (/ y t) 0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -50000000000.0) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 2000000000000.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 ((x + y) <= (-50000000000.0d0)) then
tmp = (x / t) * 0.5d0
else if ((x + y) <= 2000000000000.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 ((x + y) <= -50000000000.0) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 2000000000000.0) {
tmp = (-0.5 / t) * z;
} else {
tmp = (y / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -50000000000.0: tmp = (x / t) * 0.5 elif (x + y) <= 2000000000000.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(x + y) <= -50000000000.0) tmp = Float64(Float64(x / t) * 0.5); elseif (Float64(x + y) <= 2000000000000.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 ((x + y) <= -50000000000.0) tmp = (x / t) * 0.5; elseif ((x + y) <= 2000000000000.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[(x + y), $MachinePrecision], -50000000000.0], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 2000000000000.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}\;x + y \leq -50000000000:\\
\;\;\;\;\frac{x}{t} \cdot 0.5\\
\mathbf{elif}\;x + y \leq 2000000000000:\\
\;\;\;\;\frac{-0.5}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -5e10Initial program 99.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6440.0
Applied rewrites40.0%
if -5e10 < (+.f64 x y) < 2e12Initial 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-/.f6467.9
Applied rewrites67.9%
if 2e12 < (+.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.1
Applied rewrites85.1%
Taylor expanded in x around 0
Applied rewrites44.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.15e+69) (not (<= z 3.6e+137))) (/ (* -0.5 z) t) (* (/ (+ y x) t) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e+69) || !(z <= 3.6e+137)) {
tmp = (-0.5 * z) / t;
} else {
tmp = ((y + x) / t) * 0.5;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.15d+69)) .or. (.not. (z <= 3.6d+137))) then
tmp = ((-0.5d0) * z) / t
else
tmp = ((y + x) / t) * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e+69) || !(z <= 3.6e+137)) {
tmp = (-0.5 * z) / t;
} else {
tmp = ((y + x) / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.15e+69) or not (z <= 3.6e+137): tmp = (-0.5 * z) / t else: tmp = ((y + x) / t) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.15e+69) || !(z <= 3.6e+137)) tmp = Float64(Float64(-0.5 * z) / t); else tmp = Float64(Float64(Float64(y + x) / t) * 0.5); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.15e+69) || ~((z <= 3.6e+137))) tmp = (-0.5 * z) / t; else tmp = ((y + x) / t) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.15e+69], N[Not[LessEqual[z, 3.6e+137]], $MachinePrecision]], N[(N[(-0.5 * z), $MachinePrecision] / t), $MachinePrecision], N[(N[(N[(y + x), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+69} \lor \neg \left(z \leq 3.6 \cdot 10^{+137}\right):\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y + x}{t} \cdot 0.5\\
\end{array}
\end{array}
if z < -1.15000000000000008e69 or 3.6e137 < 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-/.f6477.9
Applied rewrites77.9%
Applied rewrites78.1%
if -1.15000000000000008e69 < z < 3.6e137Initial program 99.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6484.7
Applied rewrites84.7%
Final simplification82.9%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -1e-104) (/ (- x z) (* t 2.0)) (/ (- y z) (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e-104) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (y - z) / (t * 2.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x + y) <= (-1d-104)) then
tmp = (x - z) / (t * 2.0d0)
else
tmp = (y - z) / (t * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e-104) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (y - z) / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -1e-104: tmp = (x - z) / (t * 2.0) else: tmp = (y - z) / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -1e-104) tmp = Float64(Float64(x - z) / Float64(t * 2.0)); else tmp = Float64(Float64(y - z) / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -1e-104) tmp = (x - z) / (t * 2.0); else tmp = (y - z) / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e-104], N[(N[(x - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{-104}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t \cdot 2}\\
\end{array}
\end{array}
if (+.f64 x y) < -9.99999999999999927e-105Initial program 100.0%
Taylor expanded in y around 0
lower--.f6465.1
Applied rewrites65.1%
if -9.99999999999999927e-105 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0
lower--.f6468.1
Applied rewrites68.1%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -5e-253) (/ (- x z) (* t 2.0)) (* (/ 0.5 t) (- y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-253) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (0.5 / t) * (y - z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x + y) <= (-5d-253)) then
tmp = (x - z) / (t * 2.0d0)
else
tmp = (0.5d0 / t) * (y - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-253) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (0.5 / t) * (y - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -5e-253: tmp = (x - z) / (t * 2.0) else: tmp = (0.5 / t) * (y - z) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -5e-253) tmp = Float64(Float64(x - z) / Float64(t * 2.0)); else tmp = Float64(Float64(0.5 / t) * Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -5e-253) tmp = (x - z) / (t * 2.0); else tmp = (0.5 / t) * (y - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -5e-253], N[(N[(x - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -5 \cdot 10^{-253}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(y - z\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -4.99999999999999971e-253Initial program 100.0%
Taylor expanded in y around 0
lower--.f6468.8
Applied rewrites68.8%
if -4.99999999999999971e-253 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0
lower--.f6463.9
Applied rewrites63.9%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6463.8
Applied rewrites63.8%
(FPCore (x y z t) :precision binary64 (if (<= x -2.6e+35) (* (/ (+ y x) t) 0.5) (* (/ 0.5 t) (- y z))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.6e+35) {
tmp = ((y + x) / t) * 0.5;
} else {
tmp = (0.5 / t) * (y - z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-2.6d+35)) then
tmp = ((y + x) / t) * 0.5d0
else
tmp = (0.5d0 / t) * (y - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.6e+35) {
tmp = ((y + x) / t) * 0.5;
} else {
tmp = (0.5 / t) * (y - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.6e+35: tmp = ((y + x) / t) * 0.5 else: tmp = (0.5 / t) * (y - z) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.6e+35) tmp = Float64(Float64(Float64(y + x) / t) * 0.5); else tmp = Float64(Float64(0.5 / t) * Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.6e+35) tmp = ((y + x) / t) * 0.5; else tmp = (0.5 / t) * (y - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.6e+35], N[(N[(N[(y + x), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(0.5 / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+35}:\\
\;\;\;\;\frac{y + x}{t} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(y - z\right)\\
\end{array}
\end{array}
if x < -2.60000000000000007e35Initial program 99.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6488.9
Applied rewrites88.9%
if -2.60000000000000007e35 < x Initial program 100.0%
Taylor expanded in x around 0
lower--.f6475.9
Applied rewrites75.9%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6475.7
Applied rewrites75.7%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) 2000000000000.0) (* (/ -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 = (-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 = ((-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 = (-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 = (-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(-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 = (-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[(-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{-0.5}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < 2e12Initial program 99.9%
Taylor expanded in z around inf
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6444.7
Applied rewrites44.7%
if 2e12 < (+.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.1
Applied rewrites85.1%
Taylor expanded in x around 0
Applied rewrites44.1%
(FPCore (x y z t) :precision binary64 (* (/ 0.5 t) (- (+ y x) z)))
double code(double x, double y, double z, double t) {
return (0.5 / t) * ((y + x) - z);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (0.5d0 / t) * ((y + x) - z)
end function
public static double code(double x, double y, double z, double t) {
return (0.5 / t) * ((y + x) - z);
}
def code(x, y, z, t): return (0.5 / t) * ((y + x) - z)
function code(x, y, z, t) return Float64(Float64(0.5 / t) * Float64(Float64(y + x) - z)) end
function tmp = code(x, y, z, t) tmp = (0.5 / t) * ((y + x) - z); end
code[x_, y_, z_, t_] := N[(N[(0.5 / t), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5}{t} \cdot \left(\left(y + x\right) - z\right)
\end{array}
Initial program 100.0%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-eval99.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
(FPCore (x y z t) :precision binary64 (* (/ 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 100.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6470.6
Applied rewrites70.6%
Taylor expanded in x around 0
Applied rewrites41.1%
herbie shell --seed 2024318
(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)))