python3 Math bug: In accordance with IEEE_754-1985, math.sqrt(-1.25) should return NaN, and print function should be able to indicate it.

Bug #1891782 reported by Dan Lott
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python3-defaults (Ubuntu)
New
Undecided
Unassigned

Bug Description

python3 Math bug: In accordance with IEEE_754-1985, math.sqrt(-1.25) should return NaN, and print function should be able to indicate it.

Demo code:
import math
c = math.sqrt(-1.25)
print(c)

When run produces:
Traceback (most recent call last):
  File "./float-test.py", line 4, in <module>
    c = math.sqrt(-1.25)
ValueError: math domain error

Should produce:
NaN
 OR:
NOT A NUMBER

For more information, see https://en.wikipedia.org/wiki/NaN

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: python3 3.8.2-0ubuntu2
ProcVersionSignature: Ubuntu 5.4.0-42.46-generic 5.4.44
Uname: Linux 5.4.0-42-generic x86_64
ApportVersion: 2.20.11-0ubuntu27.6
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: KDE
Date: Sat Aug 15 21:30:13 2020
InstallationDate: Installed on 2020-04-26 (112 days ago)
InstallationMedia: Kubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
ProcEnviron:
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: python3-defaults
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Dan Lott (dlott+launchpad) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.