David Scherfgen - 5 days ago

I had Claude look into this. What it found:

The numer: true comes from COERCE-MAXIMA-FUNCTION-OR-MAXIMA-LAMBDA (and COERCE-LISP-FUNCTION-OR-LISP-LAMBDA for translated functions), which bind it around the call of a function given by name or as a lambda. Expressions take another path. These two bind it for COERCE-BFLOAT-FUN as well, so with fpprec: 40, bf_find_root(lambda([x], x^2 - %pi), 1, 2) is off by 3.5e-17 while bf_find_root(x^2 - %pi, x, 1, 2) is exact. Same for bromberg.

Its proposed fix:

  • Call the function with the user's numer (false for bigfloats). float converts the result as before.
  • Simplify what float returns, since that can be an unsimplified power like (-6.14)^(1/3). Otherwise foo17 in rtest8.mac, passed by name, goes non-numeric. This also fixes translated functions like h(x) := (x - %pi)^(1/3), which had no values for x < %pi.
  • Keep numer: true for expressions. Without it, expressions with constants like %pi evaluate 2 to 4 times slower.
  • Say so in the plot2d docs: expressions are evaluated with numer: true, functions with the current numer.

Making bfloat quote its argument only helps a literal bfloat(''expr), not block([e : ''expr], bfloat(e)), so Claude advised against it.