
(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 13 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%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ z (/ t -0.5))) (t_2 (/ (* x 0.5) t)))
(if (<= y -1.6e-301)
t_2
(if (<= y 1.6e-212)
t_1
(if (<= y 7.6e-164)
t_2
(if (or (<= y 6.5e+34) (and (not (<= y 4.4e+56)) (<= y 1.15e+73)))
t_1
(/ y (* t 2.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = z / (t / -0.5);
double t_2 = (x * 0.5) / t;
double tmp;
if (y <= -1.6e-301) {
tmp = t_2;
} else if (y <= 1.6e-212) {
tmp = t_1;
} else if (y <= 7.6e-164) {
tmp = t_2;
} else if ((y <= 6.5e+34) || (!(y <= 4.4e+56) && (y <= 1.15e+73))) {
tmp = t_1;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = z / (t / (-0.5d0))
t_2 = (x * 0.5d0) / t
if (y <= (-1.6d-301)) then
tmp = t_2
else if (y <= 1.6d-212) then
tmp = t_1
else if (y <= 7.6d-164) then
tmp = t_2
else if ((y <= 6.5d+34) .or. (.not. (y <= 4.4d+56)) .and. (y <= 1.15d+73)) then
tmp = t_1
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 t_1 = z / (t / -0.5);
double t_2 = (x * 0.5) / t;
double tmp;
if (y <= -1.6e-301) {
tmp = t_2;
} else if (y <= 1.6e-212) {
tmp = t_1;
} else if (y <= 7.6e-164) {
tmp = t_2;
} else if ((y <= 6.5e+34) || (!(y <= 4.4e+56) && (y <= 1.15e+73))) {
tmp = t_1;
} else {
tmp = y / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = z / (t / -0.5) t_2 = (x * 0.5) / t tmp = 0 if y <= -1.6e-301: tmp = t_2 elif y <= 1.6e-212: tmp = t_1 elif y <= 7.6e-164: tmp = t_2 elif (y <= 6.5e+34) or (not (y <= 4.4e+56) and (y <= 1.15e+73)): tmp = t_1 else: tmp = y / (t * 2.0) return tmp
function code(x, y, z, t) t_1 = Float64(z / Float64(t / -0.5)) t_2 = Float64(Float64(x * 0.5) / t) tmp = 0.0 if (y <= -1.6e-301) tmp = t_2; elseif (y <= 1.6e-212) tmp = t_1; elseif (y <= 7.6e-164) tmp = t_2; elseif ((y <= 6.5e+34) || (!(y <= 4.4e+56) && (y <= 1.15e+73))) tmp = t_1; else tmp = Float64(y / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z / (t / -0.5); t_2 = (x * 0.5) / t; tmp = 0.0; if (y <= -1.6e-301) tmp = t_2; elseif (y <= 1.6e-212) tmp = t_1; elseif (y <= 7.6e-164) tmp = t_2; elseif ((y <= 6.5e+34) || (~((y <= 4.4e+56)) && (y <= 1.15e+73))) tmp = t_1; else tmp = y / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z / N[(t / -0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 0.5), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[y, -1.6e-301], t$95$2, If[LessEqual[y, 1.6e-212], t$95$1, If[LessEqual[y, 7.6e-164], t$95$2, If[Or[LessEqual[y, 6.5e+34], And[N[Not[LessEqual[y, 4.4e+56]], $MachinePrecision], LessEqual[y, 1.15e+73]]], t$95$1, N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{\frac{t}{-0.5}}\\
t_2 := \frac{x \cdot 0.5}{t}\\
\mathbf{if}\;y \leq -1.6 \cdot 10^{-301}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{-212}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{-164}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+34} \lor \neg \left(y \leq 4.4 \cdot 10^{+56}\right) \land y \leq 1.15 \cdot 10^{+73}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot 2}\\
\end{array}
\end{array}
if y < -1.5999999999999999e-301 or 1.5999999999999999e-212 < y < 7.59999999999999979e-164Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 35.1%
*-commutative35.1%
associate-*l/35.1%
Simplified35.1%
if -1.5999999999999999e-301 < y < 1.5999999999999999e-212 or 7.59999999999999979e-164 < y < 6.50000000000000017e34 or 4.40000000000000032e56 < y < 1.15e73Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around inf 48.4%
associate-*r/48.4%
*-commutative48.4%
associate-/l*48.4%
Simplified48.4%
if 6.50000000000000017e34 < y < 4.40000000000000032e56 or 1.15e73 < y Initial program 99.9%
Taylor expanded in y around inf 73.0%
Final simplification46.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y 1.55e+35) (and (not (<= y 2.4e+55)) (<= y 8.7e+71))) (/ z (/ t -0.5)) (/ y (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= 1.55e+35) || (!(y <= 2.4e+55) && (y <= 8.7e+71))) {
tmp = z / (t / -0.5);
} 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 <= 1.55d+35) .or. (.not. (y <= 2.4d+55)) .and. (y <= 8.7d+71)) then
tmp = z / (t / (-0.5d0))
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 <= 1.55e+35) || (!(y <= 2.4e+55) && (y <= 8.7e+71))) {
tmp = z / (t / -0.5);
} else {
tmp = y / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= 1.55e+35) or (not (y <= 2.4e+55) and (y <= 8.7e+71)): tmp = z / (t / -0.5) else: tmp = y / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= 1.55e+35) || (!(y <= 2.4e+55) && (y <= 8.7e+71))) tmp = Float64(z / Float64(t / -0.5)); 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 <= 1.55e+35) || (~((y <= 2.4e+55)) && (y <= 8.7e+71))) tmp = z / (t / -0.5); else tmp = y / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, 1.55e+35], And[N[Not[LessEqual[y, 2.4e+55]], $MachinePrecision], LessEqual[y, 8.7e+71]]], N[(z / N[(t / -0.5), $MachinePrecision]), $MachinePrecision], N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.55 \cdot 10^{+35} \lor \neg \left(y \leq 2.4 \cdot 10^{+55}\right) \land y \leq 8.7 \cdot 10^{+71}:\\
\;\;\;\;\frac{z}{\frac{t}{-0.5}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot 2}\\
\end{array}
\end{array}
if y < 1.54999999999999993e35 or 2.3999999999999999e55 < y < 8.6999999999999997e71Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around inf 41.3%
associate-*r/41.3%
*-commutative41.3%
associate-/l*41.3%
Simplified41.3%
if 1.54999999999999993e35 < y < 2.3999999999999999e55 or 8.6999999999999997e71 < y Initial program 99.9%
Taylor expanded in y around inf 71.7%
Final simplification47.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.5e+102) (not (<= z 1.15e+131))) (/ z (/ t -0.5)) (* (+ x y) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.5e+102) || !(z <= 1.15e+131)) {
tmp = z / (t / -0.5);
} 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 <= (-2.5d+102)) .or. (.not. (z <= 1.15d+131))) then
tmp = z / (t / (-0.5d0))
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 <= -2.5e+102) || !(z <= 1.15e+131)) {
tmp = z / (t / -0.5);
} else {
tmp = (x + y) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.5e+102) or not (z <= 1.15e+131): tmp = z / (t / -0.5) else: tmp = (x + y) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.5e+102) || !(z <= 1.15e+131)) tmp = Float64(z / Float64(t / -0.5)); 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 <= -2.5e+102) || ~((z <= 1.15e+131))) tmp = z / (t / -0.5); else tmp = (x + y) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.5e+102], N[Not[LessEqual[z, 1.15e+131]], $MachinePrecision]], N[(z / N[(t / -0.5), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+102} \lor \neg \left(z \leq 1.15 \cdot 10^{+131}\right):\\
\;\;\;\;\frac{z}{\frac{t}{-0.5}}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if z < -2.5e102 or 1.14999999999999996e131 < z Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.5%
*-commutative99.5%
associate-/r*99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in z around inf 76.8%
associate-*r/76.8%
*-commutative76.8%
associate-/l*76.8%
Simplified76.8%
if -2.5e102 < z < 1.14999999999999996e131Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around 0 87.0%
*-commutative87.0%
+-commutative87.0%
associate-*l/87.0%
associate-*r/86.7%
+-commutative86.7%
Simplified86.7%
Final simplification83.9%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) 2e+31) (/ -0.5 (/ t (- z x))) (* (+ x y) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 2e+31) {
tmp = -0.5 / (t / (z - x));
} 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) <= 2d+31) then
tmp = (-0.5d0) / (t / (z - x))
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) <= 2e+31) {
tmp = -0.5 / (t / (z - x));
} else {
tmp = (x + y) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= 2e+31: tmp = -0.5 / (t / (z - x)) else: tmp = (x + y) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= 2e+31) tmp = Float64(-0.5 / Float64(t / Float64(z - x))); 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) <= 2e+31) tmp = -0.5 / (t / (z - x)); else tmp = (x + y) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], 2e+31], N[(-0.5 / N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 2 \cdot 10^{+31}:\\
\;\;\;\;\frac{-0.5}{\frac{t}{z - x}}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < 1.9999999999999999e31Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
associate-*l/100.0%
associate-/l*99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 72.1%
if 1.9999999999999999e31 < (+.f64 x y) Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0 86.7%
*-commutative86.7%
+-commutative86.7%
associate-*l/86.7%
associate-*r/86.4%
+-commutative86.4%
Simplified86.4%
Final simplification77.4%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -4e-151) (/ -0.5 (/ t (- z x))) (/ -0.5 (/ t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -4e-151) {
tmp = -0.5 / (t / (z - x));
} else {
tmp = -0.5 / (t / (z - 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) <= (-4d-151)) then
tmp = (-0.5d0) / (t / (z - x))
else
tmp = (-0.5d0) / (t / (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -4e-151) {
tmp = -0.5 / (t / (z - x));
} else {
tmp = -0.5 / (t / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -4e-151: tmp = -0.5 / (t / (z - x)) else: tmp = -0.5 / (t / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -4e-151) tmp = Float64(-0.5 / Float64(t / Float64(z - x))); else tmp = Float64(-0.5 / Float64(t / Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -4e-151) tmp = -0.5 / (t / (z - x)); else tmp = -0.5 / (t / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -4e-151], N[(-0.5 / N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 / N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -4 \cdot 10^{-151}:\\
\;\;\;\;\frac{-0.5}{\frac{t}{z - x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{\frac{t}{z - y}}\\
\end{array}
\end{array}
if (+.f64 x y) < -3.9999999999999998e-151Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
associate-*l/100.0%
associate-/l*99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 63.0%
if -3.9999999999999998e-151 < (+.f64 x y) Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.5%
*-commutative99.5%
associate-/r*99.5%
metadata-eval99.5%
Simplified99.5%
associate-*l/100.0%
associate-/l*99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 62.8%
Final simplification62.9%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) 2e-212) (/ (- x z) (* t 2.0)) (/ -0.5 (/ t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 2e-212) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = -0.5 / (t / (z - 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-212) then
tmp = (x - z) / (t * 2.0d0)
else
tmp = (-0.5d0) / (t / (z - 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-212) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = -0.5 / (t / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= 2e-212: tmp = (x - z) / (t * 2.0) else: tmp = -0.5 / (t / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= 2e-212) tmp = Float64(Float64(x - z) / Float64(t * 2.0)); else tmp = Float64(-0.5 / Float64(t / Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= 2e-212) tmp = (x - z) / (t * 2.0); else tmp = -0.5 / (t / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], 2e-212], N[(N[(x - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(-0.5 / N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 2 \cdot 10^{-212}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{\frac{t}{z - y}}\\
\end{array}
\end{array}
if (+.f64 x y) < 1.99999999999999991e-212Initial program 100.0%
Taylor expanded in y around 0 66.5%
if 1.99999999999999991e-212 < (+.f64 x y) Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
associate-*l/100.0%
associate-/l*99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 59.8%
Final simplification63.0%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -4e-151) (/ (- 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) <= -4e-151) {
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) <= (-4d-151)) 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) <= -4e-151) {
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) <= -4e-151: 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) <= -4e-151) 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) <= -4e-151) 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], -4e-151], 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 -4 \cdot 10^{-151}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t \cdot 2}\\
\end{array}
\end{array}
if (+.f64 x y) < -3.9999999999999998e-151Initial program 100.0%
Taylor expanded in y around 0 63.2%
if -3.9999999999999998e-151 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0 63.0%
Final simplification63.1%
(FPCore (x y z t) :precision binary64 (* (- z (+ x y)) (/ -0.5 t)))
double code(double x, double y, double z, double t) {
return (z - (x + y)) * (-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 - (x + y)) * ((-0.5d0) / t)
end function
public static double code(double x, double y, double z, double t) {
return (z - (x + y)) * (-0.5 / t);
}
def code(x, y, z, t): return (z - (x + y)) * (-0.5 / t)
function code(x, y, z, t) return Float64(Float64(z - Float64(x + y)) * Float64(-0.5 / t)) end
function tmp = code(x, y, z, t) tmp = (z - (x + y)) * (-0.5 / t); end
code[x_, y_, z_, t_] := N[(N[(z - N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(z - \left(x + y\right)\right) \cdot \frac{-0.5}{t}
\end{array}
Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t) :precision binary64 (/ -0.5 (/ t (- z (+ x y)))))
double code(double x, double y, double z, double t) {
return -0.5 / (t / (z - (x + y)));
}
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 / (z - (x + y)))
end function
public static double code(double x, double y, double z, double t) {
return -0.5 / (t / (z - (x + y)));
}
def code(x, y, z, t): return -0.5 / (t / (z - (x + y)))
function code(x, y, z, t) return Float64(-0.5 / Float64(t / Float64(z - Float64(x + y)))) end
function tmp = code(x, y, z, t) tmp = -0.5 / (t / (z - (x + y))); end
code[x_, y_, z_, t_] := N[(-0.5 / N[(t / N[(z - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-0.5}{\frac{t}{z - \left(x + y\right)}}
\end{array}
Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
associate-*l/100.0%
associate-/l*99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (if (<= y 5.6e+31) (* z (/ -0.5 t)) (* y (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.6e+31) {
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 <= 5.6d+31) 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 <= 5.6e+31) {
tmp = z * (-0.5 / t);
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 5.6e+31: tmp = z * (-0.5 / t) else: tmp = y * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 5.6e+31) 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 <= 5.6e+31) tmp = z * (-0.5 / t); else tmp = y * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 5.6e+31], 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 5.6 \cdot 10^{+31}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if y < 5.60000000000000034e31Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around inf 40.5%
if 5.60000000000000034e31 < y Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
associate-*l/99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
associate-*l/99.9%
associate-/l*99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 69.2%
associate-*r/69.2%
*-commutative69.2%
associate-*r/68.9%
Simplified68.9%
Final simplification46.6%
(FPCore (x y z t) :precision binary64 (if (<= y 1.3e+34) (* z (/ -0.5 t)) (/ y (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.3e+34) {
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 <= 1.3d+34) 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 <= 1.3e+34) {
tmp = z * (-0.5 / t);
} else {
tmp = y / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 1.3e+34: tmp = z * (-0.5 / t) else: tmp = y / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 1.3e+34) 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 <= 1.3e+34) tmp = z * (-0.5 / t); else tmp = y / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.3e+34], 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 1.3 \cdot 10^{+34}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot 2}\\
\end{array}
\end{array}
if y < 1.29999999999999999e34Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around inf 40.5%
if 1.29999999999999999e34 < y Initial program 99.9%
Taylor expanded in y around inf 69.2%
Final simplification46.6%
(FPCore (x y z t) :precision binary64 (* y (/ 0.5 t)))
double code(double x, double y, double z, double t) {
return y * (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 = y * (0.5d0 / t)
end function
public static double code(double x, double y, double z, double t) {
return y * (0.5 / t);
}
def code(x, y, z, t): return y * (0.5 / t)
function code(x, y, z, t) return Float64(y * Float64(0.5 / t)) end
function tmp = code(x, y, z, t) tmp = y * (0.5 / t); end
code[x_, y_, z_, t_] := N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \frac{0.5}{t}
\end{array}
Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
associate-*l/100.0%
associate-/l*99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 37.4%
associate-*r/37.4%
*-commutative37.4%
associate-*r/37.3%
Simplified37.3%
Final simplification37.3%
herbie shell --seed 2023242
(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)))