
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
(FPCore (x y z t) :precision binary64 (* (- (+ x y) z) (/ 0.5 t)))
double code(double x, double y, double z, double t) {
return ((x + y) - 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 = ((x + y) - z) * (0.5d0 / t)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) * (0.5 / t);
}
def code(x, y, z, t): return ((x + y) - z) * (0.5 / t)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) * Float64(0.5 / t)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) * (0.5 / t); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y\right) - z\right) \cdot \frac{0.5}{t}
\end{array}
Initial program 99.2%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-eval99.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -200000000000.0) (* (/ x t) 0.5) (if (<= (+ x y) 1e-11) (/ (* -0.5 z) t) (* (/ y t) 0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -200000000000.0) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 1e-11) {
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) <= (-200000000000.0d0)) then
tmp = (x / t) * 0.5d0
else if ((x + y) <= 1d-11) 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) <= -200000000000.0) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 1e-11) {
tmp = (-0.5 * z) / t;
} else {
tmp = (y / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -200000000000.0: tmp = (x / t) * 0.5 elif (x + y) <= 1e-11: 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) <= -200000000000.0) tmp = Float64(Float64(x / t) * 0.5); elseif (Float64(x + y) <= 1e-11) 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) <= -200000000000.0) tmp = (x / t) * 0.5; elseif ((x + y) <= 1e-11) 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], -200000000000.0], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 1e-11], 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 -200000000000:\\
\;\;\;\;\frac{x}{t} \cdot 0.5\\
\mathbf{elif}\;x + y \leq 10^{-11}:\\
\;\;\;\;\frac{-0.5 \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -2e11Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6449.8
Applied rewrites49.8%
if -2e11 < (+.f64 x y) < 9.99999999999999939e-12Initial 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-/.f6474.2
Applied rewrites74.2%
Applied rewrites74.4%
if 9.99999999999999939e-12 < (+.f64 x y) Initial program 98.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 rewrites76.9%
Taylor expanded in x around 0
Applied rewrites47.5%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -200000000000.0) (* (/ x t) 0.5) (if (<= (+ x y) 1e-11) (* (/ -0.5 t) z) (* (/ y t) 0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -200000000000.0) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 1e-11) {
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) <= (-200000000000.0d0)) then
tmp = (x / t) * 0.5d0
else if ((x + y) <= 1d-11) 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) <= -200000000000.0) {
tmp = (x / t) * 0.5;
} else if ((x + y) <= 1e-11) {
tmp = (-0.5 / t) * z;
} else {
tmp = (y / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -200000000000.0: tmp = (x / t) * 0.5 elif (x + y) <= 1e-11: 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) <= -200000000000.0) tmp = Float64(Float64(x / t) * 0.5); elseif (Float64(x + y) <= 1e-11) 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) <= -200000000000.0) tmp = (x / t) * 0.5; elseif ((x + y) <= 1e-11) 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], -200000000000.0], N[(N[(x / t), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 1e-11], 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 -200000000000:\\
\;\;\;\;\frac{x}{t} \cdot 0.5\\
\mathbf{elif}\;x + y \leq 10^{-11}:\\
\;\;\;\;\frac{-0.5}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -2e11Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6449.8
Applied rewrites49.8%
if -2e11 < (+.f64 x y) < 9.99999999999999939e-12Initial 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-/.f6474.2
Applied rewrites74.2%
if 9.99999999999999939e-12 < (+.f64 x y) Initial program 98.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 rewrites76.9%
Taylor expanded in x around 0
Applied rewrites47.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ (* -0.5 z) t))) (if (<= z -5.45e+160) t_1 (if (<= z 8.6e+73) (* (/ (+ x y) 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 <= -5.45e+160) {
tmp = t_1;
} else if (z <= 8.6e+73) {
tmp = ((x + y) / 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 <= (-5.45d+160)) then
tmp = t_1
else if (z <= 8.6d+73) then
tmp = ((x + y) / 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 <= -5.45e+160) {
tmp = t_1;
} else if (z <= 8.6e+73) {
tmp = ((x + y) / 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 <= -5.45e+160: tmp = t_1 elif z <= 8.6e+73: tmp = ((x + y) / 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 <= -5.45e+160) tmp = t_1; elseif (z <= 8.6e+73) tmp = Float64(Float64(Float64(x + y) / 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 <= -5.45e+160) tmp = t_1; elseif (z <= 8.6e+73) tmp = ((x + y) / 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, -5.45e+160], t$95$1, If[LessEqual[z, 8.6e+73], N[(N[(N[(x + y), $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 -5.45 \cdot 10^{+160}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{+73}:\\
\;\;\;\;\frac{x + y}{t} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.45e160 or 8.60000000000000026e73 < z Initial program 98.6%
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.8
Applied rewrites85.8%
Applied rewrites86.1%
if -5.45e160 < z < 8.60000000000000026e73Initial program 99.5%
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 rewrites85.0%
Final simplification85.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ -0.5 t) z))) (if (<= z -3e+64) t_1 (if (<= z 460.0) (* (/ y t) 0.5) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (-0.5 / t) * z;
double tmp;
if (z <= -3e+64) {
tmp = t_1;
} else if (z <= 460.0) {
tmp = (y / 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) / t) * z
if (z <= (-3d+64)) then
tmp = t_1
else if (z <= 460.0d0) then
tmp = (y / 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 / t) * z;
double tmp;
if (z <= -3e+64) {
tmp = t_1;
} else if (z <= 460.0) {
tmp = (y / t) * 0.5;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (-0.5 / t) * z tmp = 0 if z <= -3e+64: tmp = t_1 elif z <= 460.0: tmp = (y / t) * 0.5 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 <= -3e+64) tmp = t_1; elseif (z <= 460.0) tmp = Float64(Float64(y / t) * 0.5); 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 <= -3e+64) tmp = t_1; elseif (z <= 460.0) tmp = (y / 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 / t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -3e+64], t$95$1, If[LessEqual[z, 460.0], N[(N[(y / t), $MachinePrecision] * 0.5), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-0.5}{t} \cdot z\\
\mathbf{if}\;z \leq -3 \cdot 10^{+64}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 460:\\
\;\;\;\;\frac{y}{t} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.0000000000000002e64 or 460 < z Initial program 99.1%
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.6
Applied rewrites68.6%
if -3.0000000000000002e64 < z < 460Initial program 99.3%
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 rewrites91.4%
Taylor expanded in x around 0
Applied rewrites50.1%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -1e-199) (/ (- x z) (* 2.0 t)) (* (/ (- y z) t) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e-199) {
tmp = (x - z) / (2.0 * t);
} else {
tmp = ((y - z) / 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-199)) then
tmp = (x - z) / (2.0d0 * t)
else
tmp = ((y - z) / 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-199) {
tmp = (x - z) / (2.0 * t);
} else {
tmp = ((y - z) / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -1e-199: tmp = (x - z) / (2.0 * t) else: tmp = ((y - z) / t) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -1e-199) tmp = Float64(Float64(x - z) / Float64(2.0 * t)); else tmp = Float64(Float64(Float64(y - z) / t) * 0.5); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -1e-199) tmp = (x - z) / (2.0 * t); else tmp = ((y - z) / t) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e-199], N[(N[(x - z), $MachinePrecision] / N[(2.0 * t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{-199}:\\
\;\;\;\;\frac{x - z}{2 \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -9.99999999999999982e-200Initial program 100.0%
Taylor expanded in y around 0
lower--.f6468.7
Applied rewrites68.7%
if -9.99999999999999982e-200 < (+.f64 x y) Initial program 98.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6478.1
Applied rewrites78.1%
Final simplification73.6%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -1e-199) (* (- x z) (/ 0.5 t)) (* (/ (- y z) t) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e-199) {
tmp = (x - z) * (0.5 / t);
} else {
tmp = ((y - z) / 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-199)) then
tmp = (x - z) * (0.5d0 / t)
else
tmp = ((y - z) / 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-199) {
tmp = (x - z) * (0.5 / t);
} else {
tmp = ((y - z) / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -1e-199: tmp = (x - z) * (0.5 / t) else: tmp = ((y - z) / t) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -1e-199) tmp = Float64(Float64(x - z) * Float64(0.5 / t)); else tmp = Float64(Float64(Float64(y - z) / t) * 0.5); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -1e-199) tmp = (x - z) * (0.5 / t); else tmp = ((y - z) / t) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e-199], N[(N[(x - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{-199}:\\
\;\;\;\;\left(x - z\right) \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -9.99999999999999982e-200Initial program 100.0%
Taylor expanded in y around 0
lower--.f6468.7
Applied rewrites68.7%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f6468.5
Applied rewrites68.5%
if -9.99999999999999982e-200 < (+.f64 x y) Initial program 98.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6478.1
Applied rewrites78.1%
Final simplification73.5%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -200000000000.0) (* (/ (+ x y) t) 0.5) (* (/ (- y z) t) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -200000000000.0) {
tmp = ((x + y) / t) * 0.5;
} else {
tmp = ((y - z) / 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) <= (-200000000000.0d0)) then
tmp = ((x + y) / t) * 0.5d0
else
tmp = ((y - z) / 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) <= -200000000000.0) {
tmp = ((x + y) / t) * 0.5;
} else {
tmp = ((y - z) / t) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -200000000000.0: tmp = ((x + y) / t) * 0.5 else: tmp = ((y - z) / t) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -200000000000.0) tmp = Float64(Float64(Float64(x + y) / t) * 0.5); else tmp = Float64(Float64(Float64(y - z) / t) * 0.5); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -200000000000.0) tmp = ((x + y) / t) * 0.5; else tmp = ((y - z) / t) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -200000000000.0], N[(N[(N[(x + y), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -200000000000:\\
\;\;\;\;\frac{x + y}{t} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t} \cdot 0.5\\
\end{array}
\end{array}
if (+.f64 x y) < -2e11Initial 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 rewrites87.3%
if -2e11 < (+.f64 x y) Initial program 98.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6478.7
Applied rewrites78.7%
Final simplification81.8%
(FPCore (x y z t) :precision binary64 (* (/ y t) 0.5))
double code(double x, double y, double z, double t) {
return (y / t) * 0.5;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (y / t) * 0.5d0
end function
public static double code(double x, double y, double z, double t) {
return (y / t) * 0.5;
}
def code(x, y, z, t): return (y / t) * 0.5
function code(x, y, z, t) return Float64(Float64(y / t) * 0.5) end
function tmp = code(x, y, z, t) tmp = (y / t) * 0.5; end
code[x_, y_, z_, t_] := N[(N[(y / t), $MachinePrecision] * 0.5), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{t} \cdot 0.5
\end{array}
Initial program 99.2%
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 rewrites68.4%
Taylor expanded in x around 0
Applied rewrites37.4%
herbie shell --seed 2024308
(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)))