|
From: Barton W. <wil...@us...> - 2025-12-02 15:16:41
|
**proposal** Attempt to detect a floating point overflow, and when it is detected, return an `abs` nounform. Examples (done with experimental code) ~~~ (%i40) cabs(2/3 +%i*x); (%o40) sqrt(x^2+4/9) (%i41) cabs(2.3 +%i*x); (%o41) sqrt(x^2+5.289999999999999) (%i42) cabs(2.3e100 +%i*x); (%o42) sqrt(x^2+5.2899999999999995e200) ~~~ Examples of floating point overflow ~~~ (%i43) cabs(2.3e170 +%i*x); floating point overflow detected (%o43) abs(%i*x+2.3e170) (%i44) cabs(2.3 +%i*x*1.8e200); floating point overflow detected (%o44) abs(1.8e200*%i*x+2.3) ~~~ I'm not sure that this will work with all Lisp varieties. --- **[bugs:#4638] cabs/carg/polarform overflow and underflow** **Status:** open **Group:** None **Labels:** cabs carg **Created:** Sat Nov 29, 2025 07:18 AM UTC by Stavros Macrakis **Last Updated:** Mon Dec 01, 2025 08:39 PM UTC **Owner:** nobody ``cabs`` and ``carg`` on complex floats overflow and underflow even when the result is perfectly representable: <pre> cabs(1e-170 + %i*1e-170) => 0.0 but float(cabs(bfloat(1e-170 + %i*1e-170))) => 1.414213562373095e-170 cabs(1e170 + %i*1e+170) => overflow but float(cabs(bfloat(1e170 + %i*1e170))) => 1.4142135623730952e170 carg(1e170 + %i*1e+170)) => overflow but float(carg(bfloat(1e170 + %i*1e+170))) => 0.7853981633974483 carg(1e-310 + %i*1e-310) => overflow but carg(1b-310 + %i*1b-310) => 7.853981633974483b-1 polarform(1e170 + %i*1e+170) => overflow </pre> Tested in Maxima 5.48.1 SBCL 2.5.7 MacOS Intel --- Sent from sourceforge.net because max...@li... is subscribed to https://sourceforge.net/p/maxima/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/maxima/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |