During programming with Gauche (0.9.4), when I performed the process of taking an infinite logarithm, an error called Assertion failed occurred, and __Gauche itself ended __.
gosh> (log +inf.0)
"libnum.scm", line 347 (libnum_25log): Assertion failed: SCM_BIGNUMP(x)
To be honest, I'm not sure if this is a Gauche spec or an unexpected error, but it seems that if you ask for an infinite logarithm, it will cause an Assertion failed.
gosh> (log +inf.0)
"libnum.scm", line 347 (libnum_25log): Assertion failed: SCM_BIGNUMP(x)
gosh> (log -inf.0)
"libnum.scm", line 347 (libnum_25log): Assertion failed: SCM_BIGNUMP(x)
By the way, what happens in Python (3.5.1) ...
>>> import math
>>> math.log(float('inf'))
inf
>>> math.log(-float('inf'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: math domain error
It seems that only negative infinity gives an error. __ However, Python itself does not end. __ Seems to be treated as a normal exception.
By the way, for Python, if you try to ask for $ log (0) $, you will get an exception. On the other hand, Gauche seems to interpret it as diverging to negative infinity.
>>> math.log(0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: math domain error
gosh> (log 0)
-inf.0
The relationship between zero and infinity is complicated (´ ・ ω ・ `)
Recommended Posts