
(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%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.3e+86) (not (<= z 2.4e+60))) (* (- y z) (/ 0.5 t)) (* (+ x y) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.3e+86) || !(z <= 2.4e+60)) {
tmp = (y - 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 <= (-1.3d+86)) .or. (.not. (z <= 2.4d+60))) then
tmp = (y - 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 <= -1.3e+86) || !(z <= 2.4e+60)) {
tmp = (y - z) * (0.5 / t);
} else {
tmp = (x + y) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.3e+86) or not (z <= 2.4e+60): tmp = (y - z) * (0.5 / t) else: tmp = (x + y) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.3e+86) || !(z <= 2.4e+60)) tmp = Float64(Float64(y - z) * Float64(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 <= -1.3e+86) || ~((z <= 2.4e+60))) tmp = (y - 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, -1.3e+86], N[Not[LessEqual[z, 2.4e+60]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+86} \lor \neg \left(z \leq 2.4 \cdot 10^{+60}\right):\\
\;\;\;\;\left(y - z\right) \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if z < -1.2999999999999999e86 or 2.4e60 < z Initial program 100.0%
Taylor expanded in x around 0 93.4%
*-commutative93.4%
associate-*l/93.4%
associate-*r/93.1%
Simplified93.1%
if -1.2999999999999999e86 < z < 2.4e60Initial program 100.0%
Taylor expanded in z around 0 92.2%
+-commutative92.2%
Simplified92.2%
clear-num92.0%
associate-/r/92.0%
*-commutative92.0%
associate-/r*92.0%
metadata-eval92.0%
Applied egg-rr92.0%
Final simplification92.4%
(FPCore (x y z t) :precision binary64 (if (<= x -1.85e+48) (/ x (* t 2.0)) (if (<= x -2.1e-221) (/ (* z -0.5) t) (/ y (* t 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.85e+48) {
tmp = x / (t * 2.0);
} else if (x <= -2.1e-221) {
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 (x <= (-1.85d+48)) then
tmp = x / (t * 2.0d0)
else if (x <= (-2.1d-221)) 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 (x <= -1.85e+48) {
tmp = x / (t * 2.0);
} else if (x <= -2.1e-221) {
tmp = (z * -0.5) / t;
} else {
tmp = y / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.85e+48: tmp = x / (t * 2.0) elif x <= -2.1e-221: tmp = (z * -0.5) / t else: tmp = y / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.85e+48) tmp = Float64(x / Float64(t * 2.0)); elseif (x <= -2.1e-221) 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 (x <= -1.85e+48) tmp = x / (t * 2.0); elseif (x <= -2.1e-221) tmp = (z * -0.5) / t; else tmp = y / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.85e+48], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.1e-221], N[(N[(z * -0.5), $MachinePrecision] / t), $MachinePrecision], N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{+48}:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{elif}\;x \leq -2.1 \cdot 10^{-221}:\\
\;\;\;\;\frac{z \cdot -0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot 2}\\
\end{array}
\end{array}
if x < -1.85e48Initial program 100.0%
Taylor expanded in x around inf 68.4%
if -1.85e48 < x < -2.1e-221Initial program 100.0%
Taylor expanded in z around inf 51.3%
associate-*r/51.3%
Simplified51.3%
if -2.1e-221 < x Initial program 100.0%
Taylor expanded in y around inf 43.4%
Final simplification49.6%
(FPCore (x y z t) :precision binary64 (if (<= x -0.0009) (/ (- x z) (* t 2.0)) (/ (- y z) (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.0009) {
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 <= (-0.0009d0)) 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 <= -0.0009) {
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 <= -0.0009: 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 (x <= -0.0009) 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 <= -0.0009) 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[x, -0.0009], 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 \leq -0.0009:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t \cdot 2}\\
\end{array}
\end{array}
if x < -8.9999999999999998e-4Initial program 100.0%
Taylor expanded in y around 0 86.0%
if -8.9999999999999998e-4 < x Initial program 100.0%
Taylor expanded in x around 0 76.8%
(FPCore (x y z t) :precision binary64 (if (<= x -3.05e-24) (/ (- x z) (* t 2.0)) (* (- y z) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.05e-24) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (y - z) * (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 <= (-3.05d-24)) then
tmp = (x - z) / (t * 2.0d0)
else
tmp = (y - z) * (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 <= -3.05e-24) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (y - z) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.05e-24: tmp = (x - z) / (t * 2.0) else: tmp = (y - z) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.05e-24) tmp = Float64(Float64(x - z) / Float64(t * 2.0)); else tmp = Float64(Float64(y - z) * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.05e-24) tmp = (x - z) / (t * 2.0); else tmp = (y - z) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.05e-24], N[(N[(x - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.05 \cdot 10^{-24}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if x < -3.05000000000000018e-24Initial program 100.0%
Taylor expanded in y around 0 85.1%
if -3.05000000000000018e-24 < x Initial program 100.0%
Taylor expanded in x around 0 76.9%
*-commutative76.9%
associate-*l/76.9%
associate-*r/76.7%
Simplified76.7%
(FPCore (x y z t) :precision binary64 (if (<= x -3e-24) (/ 0.5 (/ t (- x z))) (* (- y z) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3e-24) {
tmp = 0.5 / (t / (x - z));
} else {
tmp = (y - z) * (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 <= (-3d-24)) then
tmp = 0.5d0 / (t / (x - z))
else
tmp = (y - z) * (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 <= -3e-24) {
tmp = 0.5 / (t / (x - z));
} else {
tmp = (y - z) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3e-24: tmp = 0.5 / (t / (x - z)) else: tmp = (y - z) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3e-24) tmp = Float64(0.5 / Float64(t / Float64(x - z))); else tmp = Float64(Float64(y - z) * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3e-24) tmp = 0.5 / (t / (x - z)); else tmp = (y - z) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3e-24], N[(0.5 / N[(t / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{-24}:\\
\;\;\;\;\frac{0.5}{\frac{t}{x - z}}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if x < -2.99999999999999995e-24Initial program 100.0%
Taylor expanded in x around 0 96.4%
associate-*r/96.4%
associate-*l/96.3%
associate-*r/96.3%
associate-*l/96.2%
distribute-lft-in99.8%
+-commutative99.8%
Simplified99.8%
associate-*l/100.0%
clear-num99.6%
associate-+l-99.6%
Applied egg-rr99.6%
frac-2neg99.6%
metadata-eval99.6%
div-inv99.6%
associate-/r*99.6%
div-inv99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
distribute-rgt-neg-in99.6%
metadata-eval99.6%
associate--r-99.6%
sub-neg99.6%
associate-+l+99.6%
+-commutative99.6%
sub-neg99.6%
Applied egg-rr99.6%
mul-1-neg99.6%
distribute-neg-frac299.6%
*-commutative99.6%
distribute-frac-neg99.6%
distribute-lft-neg-in99.6%
metadata-eval99.6%
associate-*r/99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
associate-/r*99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
associate-+r-99.6%
+-commutative99.6%
associate-+r-99.6%
Simplified99.6%
Taylor expanded in y around 0 84.8%
if -2.99999999999999995e-24 < x Initial program 100.0%
Taylor expanded in x around 0 76.9%
*-commutative76.9%
associate-*l/76.9%
associate-*r/76.7%
Simplified76.7%
(FPCore (x y z t) :precision binary64 (if (<= x -4.1e+48) (/ x (* t 2.0)) (* (- y z) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.1e+48) {
tmp = x / (t * 2.0);
} else {
tmp = (y - z) * (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 <= (-4.1d+48)) then
tmp = x / (t * 2.0d0)
else
tmp = (y - z) * (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 <= -4.1e+48) {
tmp = x / (t * 2.0);
} else {
tmp = (y - z) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4.1e+48: tmp = x / (t * 2.0) else: tmp = (y - z) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4.1e+48) tmp = Float64(x / Float64(t * 2.0)); else tmp = Float64(Float64(y - z) * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -4.1e+48) tmp = x / (t * 2.0); else tmp = (y - z) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.1e+48], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.1 \cdot 10^{+48}:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if x < -4.1000000000000003e48Initial program 100.0%
Taylor expanded in x around inf 68.4%
if -4.1000000000000003e48 < x Initial program 100.0%
Taylor expanded in x around 0 77.3%
*-commutative77.3%
associate-*l/77.3%
associate-*r/77.1%
Simplified77.1%
(FPCore (x y z t) :precision binary64 (if (<= x -0.049) (/ x (* t 2.0)) (/ y (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.049) {
tmp = x / (t * 2.0);
} 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 (x <= (-0.049d0)) then
tmp = x / (t * 2.0d0)
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 (x <= -0.049) {
tmp = x / (t * 2.0);
} else {
tmp = y / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -0.049: tmp = x / (t * 2.0) else: tmp = y / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -0.049) tmp = Float64(x / Float64(t * 2.0)); else tmp = Float64(y / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -0.049) tmp = x / (t * 2.0); else tmp = y / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -0.049], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.049:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot 2}\\
\end{array}
\end{array}
if x < -0.049000000000000002Initial program 100.0%
Taylor expanded in x around inf 60.5%
if -0.049000000000000002 < x Initial program 100.0%
Taylor expanded in y around inf 44.5%
(FPCore (x y z t) :precision binary64 (if (<= x -0.048) (/ x (* t 2.0)) (/ 0.5 (/ t y))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.048) {
tmp = x / (t * 2.0);
} else {
tmp = 0.5 / (t / 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 <= (-0.048d0)) then
tmp = x / (t * 2.0d0)
else
tmp = 0.5d0 / (t / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.048) {
tmp = x / (t * 2.0);
} else {
tmp = 0.5 / (t / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -0.048: tmp = x / (t * 2.0) else: tmp = 0.5 / (t / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -0.048) tmp = Float64(x / Float64(t * 2.0)); else tmp = Float64(0.5 / Float64(t / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -0.048) tmp = x / (t * 2.0); else tmp = 0.5 / (t / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -0.048], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[(t / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.048:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{t}{y}}\\
\end{array}
\end{array}
if x < -0.048000000000000001Initial program 100.0%
Taylor expanded in x around inf 60.5%
if -0.048000000000000001 < x Initial program 100.0%
Taylor expanded in x around 0 99.0%
associate-*r/99.0%
associate-*l/98.9%
associate-*r/98.9%
associate-*l/98.7%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
associate-*l/100.0%
clear-num99.8%
associate-+l-99.8%
Applied egg-rr99.8%
frac-2neg99.8%
metadata-eval99.8%
div-inv99.8%
associate-/r*99.8%
div-inv99.8%
metadata-eval99.8%
distribute-neg-frac99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
associate--r-99.8%
sub-neg99.8%
associate-+l+99.8%
+-commutative99.8%
sub-neg99.8%
Applied egg-rr99.8%
mul-1-neg99.8%
distribute-neg-frac299.8%
*-commutative99.8%
distribute-frac-neg99.8%
distribute-lft-neg-in99.8%
metadata-eval99.8%
associate-*r/99.8%
metadata-eval99.8%
distribute-neg-frac99.8%
associate-/r*99.8%
metadata-eval99.8%
distribute-neg-frac99.8%
metadata-eval99.8%
associate-+r-99.8%
+-commutative99.8%
associate-+r-99.8%
Simplified99.8%
Taylor expanded in y around inf 44.5%
(FPCore (x y z t) :precision binary64 (if (<= x -0.0265) (/ 0.5 (/ t x)) (/ 0.5 (/ t y))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.0265) {
tmp = 0.5 / (t / x);
} else {
tmp = 0.5 / (t / 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 <= (-0.0265d0)) then
tmp = 0.5d0 / (t / x)
else
tmp = 0.5d0 / (t / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.0265) {
tmp = 0.5 / (t / x);
} else {
tmp = 0.5 / (t / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -0.0265: tmp = 0.5 / (t / x) else: tmp = 0.5 / (t / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -0.0265) tmp = Float64(0.5 / Float64(t / x)); else tmp = Float64(0.5 / Float64(t / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -0.0265) tmp = 0.5 / (t / x); else tmp = 0.5 / (t / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -0.0265], N[(0.5 / N[(t / x), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[(t / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0265:\\
\;\;\;\;\frac{0.5}{\frac{t}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{t}{y}}\\
\end{array}
\end{array}
if x < -0.0264999999999999993Initial program 100.0%
Taylor expanded in x around 0 96.2%
associate-*r/96.2%
associate-*l/96.1%
associate-*r/96.1%
associate-*l/96.0%
distribute-lft-in99.8%
+-commutative99.8%
Simplified99.8%
associate-*l/100.0%
clear-num99.6%
associate-+l-99.6%
Applied egg-rr99.6%
frac-2neg99.6%
metadata-eval99.6%
div-inv99.6%
associate-/r*99.6%
div-inv99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
distribute-rgt-neg-in99.6%
metadata-eval99.6%
associate--r-99.6%
sub-neg99.6%
associate-+l+99.6%
+-commutative99.6%
sub-neg99.6%
Applied egg-rr99.6%
mul-1-neg99.6%
distribute-neg-frac299.6%
*-commutative99.6%
distribute-frac-neg99.6%
distribute-lft-neg-in99.6%
metadata-eval99.6%
associate-*r/99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
associate-/r*99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
associate-+r-99.6%
+-commutative99.6%
associate-+r-99.6%
Simplified99.6%
Taylor expanded in x around inf 60.4%
if -0.0264999999999999993 < x Initial program 100.0%
Taylor expanded in x around 0 99.0%
associate-*r/99.0%
associate-*l/98.9%
associate-*r/98.9%
associate-*l/98.7%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
associate-*l/100.0%
clear-num99.8%
associate-+l-99.8%
Applied egg-rr99.8%
frac-2neg99.8%
metadata-eval99.8%
div-inv99.8%
associate-/r*99.8%
div-inv99.8%
metadata-eval99.8%
distribute-neg-frac99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
associate--r-99.8%
sub-neg99.8%
associate-+l+99.8%
+-commutative99.8%
sub-neg99.8%
Applied egg-rr99.8%
mul-1-neg99.8%
distribute-neg-frac299.8%
*-commutative99.8%
distribute-frac-neg99.8%
distribute-lft-neg-in99.8%
metadata-eval99.8%
associate-*r/99.8%
metadata-eval99.8%
distribute-neg-frac99.8%
associate-/r*99.8%
metadata-eval99.8%
distribute-neg-frac99.8%
metadata-eval99.8%
associate-+r-99.8%
+-commutative99.8%
associate-+r-99.8%
Simplified99.8%
Taylor expanded in y around inf 44.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(0.5 / Float64(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[(0.5 / N[(t / N[(x + N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5}{\frac{t}{x + \left(y - z\right)}}
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 98.4%
associate-*r/98.4%
associate-*l/98.3%
associate-*r/98.3%
associate-*l/98.2%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
associate-*l/100.0%
clear-num99.7%
associate-+l-99.7%
Applied egg-rr99.7%
frac-2neg99.7%
metadata-eval99.7%
div-inv99.7%
associate-/r*99.7%
div-inv99.7%
metadata-eval99.7%
distribute-neg-frac99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
associate--r-99.7%
sub-neg99.7%
associate-+l+99.7%
+-commutative99.7%
sub-neg99.7%
Applied egg-rr99.7%
mul-1-neg99.7%
distribute-neg-frac299.7%
*-commutative99.7%
distribute-frac-neg99.7%
distribute-lft-neg-in99.7%
metadata-eval99.7%
associate-*r/99.7%
metadata-eval99.7%
distribute-neg-frac99.7%
associate-/r*99.7%
metadata-eval99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
associate-+r-99.7%
+-commutative99.7%
associate-+r-99.7%
Simplified99.7%
(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(x + Float64(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[(x + N[(y - z), $MachinePrecision]), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \left(y - z\right)\right) \cdot \frac{0.5}{t}
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 98.4%
associate-*r/98.4%
associate-*l/98.3%
associate-*r/98.3%
associate-*l/98.2%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (/ 0.5 (/ t x)))
double code(double x, double y, double z, double t) {
return 0.5 / (t / x);
}
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)
end function
public static double code(double x, double y, double z, double t) {
return 0.5 / (t / x);
}
def code(x, y, z, t): return 0.5 / (t / x)
function code(x, y, z, t) return Float64(0.5 / Float64(t / x)) end
function tmp = code(x, y, z, t) tmp = 0.5 / (t / x); end
code[x_, y_, z_, t_] := N[(0.5 / N[(t / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5}{\frac{t}{x}}
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 98.4%
associate-*r/98.4%
associate-*l/98.3%
associate-*r/98.3%
associate-*l/98.2%
distribute-lft-in99.7%
+-commutative99.7%
Simplified99.7%
associate-*l/100.0%
clear-num99.7%
associate-+l-99.7%
Applied egg-rr99.7%
frac-2neg99.7%
metadata-eval99.7%
div-inv99.7%
associate-/r*99.7%
div-inv99.7%
metadata-eval99.7%
distribute-neg-frac99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
associate--r-99.7%
sub-neg99.7%
associate-+l+99.7%
+-commutative99.7%
sub-neg99.7%
Applied egg-rr99.7%
mul-1-neg99.7%
distribute-neg-frac299.7%
*-commutative99.7%
distribute-frac-neg99.7%
distribute-lft-neg-in99.7%
metadata-eval99.7%
associate-*r/99.7%
metadata-eval99.7%
distribute-neg-frac99.7%
associate-/r*99.7%
metadata-eval99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
associate-+r-99.7%
+-commutative99.7%
associate-+r-99.7%
Simplified99.7%
Taylor expanded in x around inf 36.2%
herbie shell --seed 2024145
(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)))