
(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 12 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 (or (<= z -4e+89) (not (<= z 1.12e+77))) (/ (* z -0.5) t) (* (+ x y) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4e+89) || !(z <= 1.12e+77)) {
tmp = (z * -0.5) / t;
} else {
tmp = (x + y) * (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 ((z <= (-4d+89)) .or. (.not. (z <= 1.12d+77))) then
tmp = (z * (-0.5d0)) / t
else
tmp = (x + y) * (0.5d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4e+89) || !(z <= 1.12e+77)) {
tmp = (z * -0.5) / t;
} else {
tmp = (x + y) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4e+89) or not (z <= 1.12e+77): tmp = (z * -0.5) / t else: tmp = (x + y) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4e+89) || !(z <= 1.12e+77)) tmp = Float64(Float64(z * -0.5) / t); else tmp = Float64(Float64(x + y) * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4e+89) || ~((z <= 1.12e+77))) tmp = (z * -0.5) / t; else tmp = (x + y) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4e+89], N[Not[LessEqual[z, 1.12e+77]], $MachinePrecision]], N[(N[(z * -0.5), $MachinePrecision] / t), $MachinePrecision], N[(N[(x + y), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+89} \lor \neg \left(z \leq 1.12 \cdot 10^{+77}\right):\\
\;\;\;\;\frac{z \cdot -0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if z < -3.99999999999999998e89 or 1.1199999999999999e77 < z Initial program 100.0%
Taylor expanded in z around inf 77.2%
associate-*r/77.2%
Simplified77.2%
if -3.99999999999999998e89 < z < 1.1199999999999999e77Initial program 100.0%
Taylor expanded in x around 0 96.9%
associate-*r/96.9%
associate-*l/96.7%
associate-*r/96.7%
associate-*l/96.6%
distribute-lft-in99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in z around 0 89.7%
Final simplification85.1%
(FPCore (x y z t) :precision binary64 (if (<= y -4.8e-277) (/ x (* t 2.0)) (if (<= y 2.6e+69) (/ (* z -0.5) t) (/ y (* t 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.8e-277) {
tmp = x / (t * 2.0);
} else if (y <= 2.6e+69) {
tmp = (z * -0.5) / t;
} else {
tmp = y / (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 (y <= (-4.8d-277)) then
tmp = x / (t * 2.0d0)
else if (y <= 2.6d+69) then
tmp = (z * (-0.5d0)) / t
else
tmp = y / (t * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.8e-277) {
tmp = x / (t * 2.0);
} else if (y <= 2.6e+69) {
tmp = (z * -0.5) / t;
} else {
tmp = y / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4.8e-277: tmp = x / (t * 2.0) elif y <= 2.6e+69: tmp = (z * -0.5) / t else: tmp = y / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4.8e-277) tmp = Float64(x / Float64(t * 2.0)); elseif (y <= 2.6e+69) tmp = Float64(Float64(z * -0.5) / t); else tmp = Float64(y / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4.8e-277) tmp = x / (t * 2.0); elseif (y <= 2.6e+69) tmp = (z * -0.5) / t; else tmp = y / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.8e-277], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.6e+69], N[(N[(z * -0.5), $MachinePrecision] / t), $MachinePrecision], N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{-277}:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+69}:\\
\;\;\;\;\frac{z \cdot -0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot 2}\\
\end{array}
\end{array}
if y < -4.8e-277Initial program 100.0%
Taylor expanded in x around inf 39.3%
if -4.8e-277 < y < 2.6000000000000002e69Initial program 100.0%
Taylor expanded in z around inf 48.6%
associate-*r/48.6%
Simplified48.6%
if 2.6000000000000002e69 < y Initial program 99.9%
Taylor expanded in y around inf 74.5%
Final simplification49.8%
(FPCore (x y z t) :precision binary64 (if (<= y -4.8e-277) (/ x (* t 2.0)) (if (<= y 2.8e+70) (* z (/ -0.5 t)) (/ y (* t 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.8e-277) {
tmp = x / (t * 2.0);
} else if (y <= 2.8e+70) {
tmp = z * (-0.5 / t);
} else {
tmp = y / (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 (y <= (-4.8d-277)) then
tmp = x / (t * 2.0d0)
else if (y <= 2.8d+70) then
tmp = z * ((-0.5d0) / t)
else
tmp = y / (t * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.8e-277) {
tmp = x / (t * 2.0);
} else if (y <= 2.8e+70) {
tmp = z * (-0.5 / t);
} else {
tmp = y / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4.8e-277: tmp = x / (t * 2.0) elif y <= 2.8e+70: tmp = z * (-0.5 / t) else: tmp = y / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4.8e-277) tmp = Float64(x / Float64(t * 2.0)); elseif (y <= 2.8e+70) tmp = Float64(z * Float64(-0.5 / t)); else tmp = Float64(y / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4.8e-277) tmp = x / (t * 2.0); elseif (y <= 2.8e+70) tmp = z * (-0.5 / t); else tmp = y / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.8e-277], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.8e+70], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{-277}:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+70}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot 2}\\
\end{array}
\end{array}
if y < -4.8e-277Initial program 100.0%
Taylor expanded in x around inf 39.3%
if -4.8e-277 < y < 2.7999999999999999e70Initial program 100.0%
Taylor expanded in x around 0 100.0%
associate-*r/100.0%
associate-*l/99.9%
associate-*r/99.9%
associate-*l/99.6%
distribute-lft-in99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in z around inf 48.6%
*-commutative48.6%
associate-*l/48.6%
associate-*r/48.4%
Simplified48.4%
if 2.7999999999999999e70 < y Initial program 99.9%
Taylor expanded in y around inf 74.5%
(FPCore (x y z t) :precision binary64 (if (<= y -7.2e-277) (/ x (* t 2.0)) (if (<= y 5.5e+70) (* z (/ -0.5 t)) (* y (/ 0.5 t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.2e-277) {
tmp = x / (t * 2.0);
} else if (y <= 5.5e+70) {
tmp = z * (-0.5 / t);
} else {
tmp = y * (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 <= (-7.2d-277)) then
tmp = x / (t * 2.0d0)
else if (y <= 5.5d+70) then
tmp = z * ((-0.5d0) / t)
else
tmp = y * (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 <= -7.2e-277) {
tmp = x / (t * 2.0);
} else if (y <= 5.5e+70) {
tmp = z * (-0.5 / t);
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -7.2e-277: tmp = x / (t * 2.0) elif y <= 5.5e+70: tmp = z * (-0.5 / t) else: tmp = y * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -7.2e-277) tmp = Float64(x / Float64(t * 2.0)); elseif (y <= 5.5e+70) tmp = Float64(z * Float64(-0.5 / t)); else tmp = Float64(y * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -7.2e-277) tmp = x / (t * 2.0); elseif (y <= 5.5e+70) tmp = z * (-0.5 / t); else tmp = y * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -7.2e-277], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.5e+70], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{-277}:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+70}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if y < -7.19999999999999968e-277Initial program 100.0%
Taylor expanded in x around inf 39.3%
if -7.19999999999999968e-277 < y < 5.49999999999999986e70Initial program 100.0%
Taylor expanded in x around 0 100.0%
associate-*r/100.0%
associate-*l/99.9%
associate-*r/99.9%
associate-*l/99.6%
distribute-lft-in99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in z around inf 48.6%
*-commutative48.6%
associate-*l/48.6%
associate-*r/48.4%
Simplified48.4%
if 5.49999999999999986e70 < y Initial program 99.9%
Taylor expanded in x around 0 96.5%
associate-*r/96.5%
associate-*l/96.4%
associate-*r/96.4%
associate-*l/96.2%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 74.3%
Final simplification49.7%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -5e-171) (/ (- 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) <= -5e-171) {
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) <= (-5d-171)) 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) <= -5e-171) {
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) <= -5e-171: 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) <= -5e-171) 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) <= -5e-171) 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], -5e-171], 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 -5 \cdot 10^{-171}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t \cdot 2}\\
\end{array}
\end{array}
if (+.f64 x y) < -4.99999999999999992e-171Initial program 100.0%
Taylor expanded in y around 0 67.9%
if -4.99999999999999992e-171 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0 71.6%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) 4e+69) (/ (- x z) (* t 2.0)) (/ (+ x y) (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 4e+69) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (x + y) / (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) <= 4d+69) then
tmp = (x - z) / (t * 2.0d0)
else
tmp = (x + y) / (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) <= 4e+69) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (x + y) / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= 4e+69: tmp = (x - z) / (t * 2.0) else: tmp = (x + y) / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= 4e+69) tmp = Float64(Float64(x - z) / Float64(t * 2.0)); else tmp = Float64(Float64(x + y) / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= 4e+69) tmp = (x - z) / (t * 2.0); else tmp = (x + y) / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], 4e+69], N[(N[(x - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 4 \cdot 10^{+69}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y}{t \cdot 2}\\
\end{array}
\end{array}
if (+.f64 x y) < 4.0000000000000003e69Initial program 100.0%
Taylor expanded in y around 0 74.2%
if 4.0000000000000003e69 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0 89.0%
+-commutative89.0%
Simplified89.0%
Final simplification79.3%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) 5e+23) (* (/ 0.5 t) (- x z)) (/ (+ x y) (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 5e+23) {
tmp = (0.5 / t) * (x - z);
} else {
tmp = (x + y) / (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) <= 5d+23) then
tmp = (0.5d0 / t) * (x - z)
else
tmp = (x + y) / (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) <= 5e+23) {
tmp = (0.5 / t) * (x - z);
} else {
tmp = (x + y) / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= 5e+23: tmp = (0.5 / t) * (x - z) else: tmp = (x + y) / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= 5e+23) tmp = Float64(Float64(0.5 / t) * Float64(x - z)); else tmp = Float64(Float64(x + y) / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= 5e+23) tmp = (0.5 / t) * (x - z); else tmp = (x + y) / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], 5e+23], N[(N[(0.5 / t), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 5 \cdot 10^{+23}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(x - z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y}{t \cdot 2}\\
\end{array}
\end{array}
if (+.f64 x y) < 4.9999999999999999e23Initial program 100.0%
Taylor expanded in x around 0 98.1%
associate-*r/98.1%
associate-*l/98.0%
associate-*r/98.0%
associate-*l/97.8%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 73.1%
if 4.9999999999999999e23 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0 83.9%
+-commutative83.9%
Simplified83.9%
Final simplification77.3%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) 4e+69) (* (/ 0.5 t) (- x z)) (* (+ x y) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 4e+69) {
tmp = (0.5 / t) * (x - z);
} else {
tmp = (x + y) * (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 ((x + y) <= 4d+69) then
tmp = (0.5d0 / t) * (x - z)
else
tmp = (x + y) * (0.5d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 4e+69) {
tmp = (0.5 / t) * (x - z);
} else {
tmp = (x + y) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= 4e+69: tmp = (0.5 / t) * (x - z) else: tmp = (x + y) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= 4e+69) tmp = Float64(Float64(0.5 / t) * Float64(x - z)); else tmp = Float64(Float64(x + y) * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= 4e+69) tmp = (0.5 / t) * (x - z); else tmp = (x + y) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], 4e+69], N[(N[(0.5 / t), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 4 \cdot 10^{+69}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(x - z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < 4.0000000000000003e69Initial program 100.0%
Taylor expanded in x around 0 98.2%
associate-*r/98.2%
associate-*l/98.1%
associate-*r/98.1%
associate-*l/97.9%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 73.9%
if 4.0000000000000003e69 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0 96.6%
associate-*r/96.6%
associate-*l/96.4%
associate-*r/96.4%
associate-*l/96.3%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in z around 0 88.8%
Final simplification79.0%
(FPCore (x y z t) :precision binary64 (if (<= y 4.3e+71) (* z (/ -0.5 t)) (* y (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.3e+71) {
tmp = z * (-0.5 / t);
} else {
tmp = y * (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 <= 4.3d+71) then
tmp = z * ((-0.5d0) / t)
else
tmp = y * (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 <= 4.3e+71) {
tmp = z * (-0.5 / t);
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 4.3e+71: tmp = z * (-0.5 / t) else: tmp = y * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 4.3e+71) tmp = Float64(z * Float64(-0.5 / t)); else tmp = Float64(y * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 4.3e+71) tmp = z * (-0.5 / t); else tmp = y * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 4.3e+71], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.3 \cdot 10^{+71}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if y < 4.29999999999999984e71Initial program 100.0%
Taylor expanded in x around 0 98.0%
associate-*r/98.0%
associate-*l/97.9%
associate-*r/97.9%
associate-*l/97.7%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in z around inf 42.5%
*-commutative42.5%
associate-*l/42.5%
associate-*r/42.4%
Simplified42.4%
if 4.29999999999999984e71 < y Initial program 99.9%
Taylor expanded in x around 0 96.5%
associate-*r/96.5%
associate-*l/96.4%
associate-*r/96.4%
associate-*l/96.2%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 74.3%
Final simplification49.5%
(FPCore (x y z t) :precision binary64 (* (/ 0.5 t) (+ x (- y z))))
double code(double x, double y, double z, double t) {
return (0.5 / t) * (x + (y - 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) * (x + (y - z))
end function
public static double code(double x, double y, double z, double t) {
return (0.5 / t) * (x + (y - z));
}
def code(x, y, z, t): return (0.5 / t) * (x + (y - z))
function code(x, y, z, t) return Float64(Float64(0.5 / t) * Float64(x + Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = (0.5 / t) * (x + (y - z)); end
code[x_, y_, z_, t_] := N[(N[(0.5 / t), $MachinePrecision] * N[(x + N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5}{t} \cdot \left(x + \left(y - z\right)\right)
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 97.6%
associate-*r/97.6%
associate-*l/97.5%
associate-*r/97.5%
associate-*l/97.3%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (* z (/ -0.5 t)))
double code(double x, double y, double z, double t) {
return 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 = z * ((-0.5d0) / t)
end function
public static double code(double x, double y, double z, double t) {
return z * (-0.5 / t);
}
def code(x, y, z, t): return z * (-0.5 / t)
function code(x, y, z, t) return Float64(z * Float64(-0.5 / t)) end
function tmp = code(x, y, z, t) tmp = z * (-0.5 / t); end
code[x_, y_, z_, t_] := N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \frac{-0.5}{t}
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 97.6%
associate-*r/97.6%
associate-*l/97.5%
associate-*r/97.5%
associate-*l/97.3%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in z around inf 37.1%
*-commutative37.1%
associate-*l/37.1%
associate-*r/37.0%
Simplified37.0%
herbie shell --seed 2024146
(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)))