Ask Your Question

Revision history [back]

The issue is not the RealField. The issue seems to have something to do with the precision. 28.0 is simply a RealNumber with the default precision of 53 bits. Here are my results for various precisions:

sage: erfc(RealField(53)(28))
6.56321584032878e-343
sage: erfc(RealField(64)(28))
6.56321584032878415e-343
sage: erfc(RealField(128)(28))
6.5632158403287841523809104816062747741e-343
sage: erfc(RealField(192)(28))
6.56321584032878415238091048160627477413416268994828261802e-343
sage: erfc(RealField(256)(28))
uceil_log2.c:40: MPFR assertion failed: exp < 1023
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)

The real error is the "MPRF assertion failed: exp < 1023". This probably has something to do with the C implementation of mpfr_erfc, which is a third party library. I.e., it is used by SAGE, but it was not written by the SAGE team. I believe the MPFR library is still actively maintained, so maybe the SAGE team can reach out to the MPFR developers?

The issue is not the RealField. The issue seems to have something to do with the precision. 28.0 is simply a RealNumber with the default precision of 53 bits. Here are my results for various precisions:

sage: erfc(RealField(53)(28))
6.56321584032878e-343
sage: erfc(RealField(64)(28))
6.56321584032878415e-343
sage: erfc(RealField(128)(28))
6.5632158403287841523809104816062747741e-343
sage: erfc(RealField(192)(28))
6.56321584032878415238091048160627477413416268994828261802e-343
sage: erfc(RealField(256)(28))
uceil_log2.c:40: MPFR assertion failed: exp < 1023
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)

The real error is the "MPRF assertion failed: exp < 1023". This probably has something to do with the C implementation of mpfr_erfc, which is a third party library. I.e., it is used by SAGE, but it was not written by the SAGE team. I believe the MPFR library is still actively maintained, so maybe the SAGE team can reach out to the MPFR developers?

Edit: By the way, if you want to test with a standard double precision floating point number, put a letter 'r' after the number:

sage: isinstance(28.0, sage.rings.real_mpfr.RealNumber)
True
sage: isinstance(28.0r, float)
True
sage: erfc(28.0)
6.56321584032878e-343
sage: erfc(28.0r)
0.0