@@ -145,7 +145,7 @@ FindRootResult!T findRoot(alias f, alias tolerance = null, T)(
145145 const T ax,
146146 const T bx,
147147 const T fax = - T.nan,
148- const T fbx = + T.nan)
148+ const T fbx = + T.nan) @safe
149149 if (
150150 isFloatingPoint! T && __traits(compiles, T(f(T.init))) &&
151151 (
@@ -163,22 +163,25 @@ FindRootResult!T findRoot(alias f, alias tolerance = null, T)(
163163 scope funInst = delegate (T x) {
164164 return T (f(x));
165165 };
166-
167166 scope fun = funInst.trustedAllAttr;
168167
169- scope bool delegate (T, T) @safe pure nothrow @nogc tol;
170- static if (! is (typeof (tolerance) == typeof (null )))
168+ static if (is (typeof (tolerance) == typeof (null )))
169+ {
170+ return findRootImpl (ax, bx, fax, fbx, fun, null );
171+ }
172+ else
171173 {
172174 scope tolInst = delegate (T a, T b) {
173175 return bool (tolerance(a, b));
174176 };
175- tol = tolInst.trustedAllAttr;
177+ scope tol = tolInst.trustedAllAttr;
178+ return findRootImpl (ax, bx, fax, fbx, fun, tol);
176179 }
177- return findRootImpl (ax, bx, fax, fbx, fun, tol);
178180}
179181
180182// /
181- version (mir_test) @safe @nogc unittest
183+ // @nogc
184+ version (mir_test) @safe unittest
182185{
183186 import mir.math.common: log, exp;
184187
10651068}
10661069
10671070// /
1068- version (mir_test) @safe @nogc unittest
1071+ // @nogc
1072+ version (mir_test) @safe unittest
10691073{
10701074 import mir.math.common: approxEqual;
10711075
0 commit comments