Compare "relationship between log and infinity" in Gauche (0.9.4) and Python (3.5.1)

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

Compare "relationship between log and infinity" in Gauche (0.9.4) and Python (3.5.1)
Difference between list () and [] in Python
Difference between == and is in python
Differences in authenticity between Python and JavaScript
Differences between Ruby and Python in scope
difference between statements (statements) and expressions (expressions) in Python
Differences in syntax between Python and Java
Difference between @classmethod and @staticmethod in Python
Difference between append and + = in Python list
Difference between nonlocal and global in Python
[python] Difference between variables and self. Variables in class
About the difference between "==" and "is" in python
Compare strings in Python
Investigate the relationship between TensorFlow and Keras in transition
Difference between Ruby and Python in terms of variables
Mutual conversion between JSON and YAML / TOML in Python
Difference between return, return None, and no return description in Python
Stack and Queue in Python
Unittest and CI in Python
Python module num2words Difference in behavior between English and Russian
List concatenation method in python, difference between list.extend () and “+” operator
How to log in to AtCoder with Python and submit automatically
Difference between Ruby and Python split
Difference between java and python (memo)
MIDI packages in Python midi and pretty_midi
View photos in Python and html
Sorting algorithm and implementation in Python
Manipulate files and folders in Python
About dtypes in Python and Cython
Assignments and changes in Python objects
Cooperation between python module and API
Difference in how to write if statement between ruby ​​and python
Differences between Python, stftime and strptime
Difference between python2 series and python3 series dict.keys ()
Ciphertext in Python: IND-CCA2 and RSA-OAEP
Hashing data in R and Python
Function synthesis and application in Python
Export and output files in Python
Transcendental simple and clear! !! Difference between single quotes and double quotes in Python
(Python) ABC162-D Consideration log and solution
Compare Python and JavaScript array loops
[Python] Difference between function and method
Reverse Hiragana and Katakana in Python2.7
Reading and writing text in Python
[GUI in Python] PyQt5-Menu and Toolbar-
Python --Difference between exec and eval
[Python] Difference between randrange () and randint ()
[Python] Difference between sorted and sorted (Colaboratory)
Create and read messagepacks in Python
Communicate between Elixir and Python with gRPC
Overlapping regular expressions in Python and Java
Notes using cChardet and python3-chardet in Python 3.3.1.
AM modulation and demodulation in Python Part 2
Eigenvalues and eigenvectors: Linear algebra in Python <7>
Line graphs and scale lines in python
Implement FIR filters in Python and C
Check and receive Serial port in Python (Port check)
Difference between PHP and Python finally and exit
Search and play YouTube videos in Python
Log in to Slack using requests in Python
Write O_SYNC file in C and Python