Aerl[x_, b_] :=
Module[{c = N[Sqrt[2/(Pi x)]], start, a},
  start = If[b >= c,
    x + (b-c)/(c^2),
    ((Sqrt[-2 Log[(2-b/c) b/c]] - 2 Sqrt[x])^2+1)/4
  ];
  a /. FindRoot[a (b - Berld[x,a]) == 0, {a, {start, start + 1}}]
] /; (0 < b < 1)
(* needs also the definition of the function Berld *)