Originally I was concerned that the linear-time exponentiation in strtod/strtol was a security flaw: parsing a number with a really big exponent would take really long, acting as a DoS attack.
However, the current implementation checks for overflow and underflow and hence I can't see a way to get the loop to run more than a few hundred times, so there doesn't seem to be any security risk after all. Nevertheless, by the time I worked this out I'd already written a more intelligent exponentiation function, so here it is.
Thanks to kevlarman for making me find the iterative instead of the recursive version.
Created attachment 3126 [details] faster exponentiation for bg_lib.c Patch failed to attach the first time, trying again...