3.4.1 Esempio

L'esempio seguente mostra come avviare ed esaminare il funzionamento del modulo fpectl.

>>> import fpectl
>>> import fpetest
>>> fpectl.turnon_sigfpe()
>>> fpetest.test()
overflow        PASS
FloatingPointError: Overflow

div by 0        PASS
FloatingPointError: Division by zero
  [ more output from test elided ]
>>> import math
>>> math.exp(1000)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
FloatingPointError: in math_1

Vedete Circa questo documento... per informazioni su modifiche e suggerimenti.