Issue2140

classification
Title: math.sqrt and math.log domain error issues
Type: behaviour Severity: normal
Components: Library Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: mb_, santa4nt, zyasoft
Priority: Keywords: patch

Created on 2014-05-12.08:23:13 by mb_, last changed 2014-05-21.20:37:11 by zyasoft.

Files
File name Uploaded Description Edit Remove
test403.py mb_, 2014-05-12.08:23:12 bugtest
issue2140.diff santa4nt, 2014-05-12.18:58:58
issue2140.diff santa4nt, 2014-05-12.20:57:09
Messages
msg8380 (view) Author: Michael Büsch (mb_) Date: 2014-05-12.08:23:12
All of these calls
  math.sqrt(negative value)
  math.log(0.0)
  math.log(negative value)
should raise
  ValueError: math domain error

Current jython 2.7 just returns NaN or Inf.

Attached is a bugtest script.
msg8383 (view) Author: Santoso Wijaya (santa4nt) Date: 2014-05-12.18:58:58
Fix and test.
msg8384 (view) Author: Michael Büsch (mb_) Date: 2014-05-12.19:42:32
This fix still seems to be buggy:

Python 2.7:
>>> math.sqrt(-0.5)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: math domain error

Jython:
>>> math.sqrt(-0.5)
nan
msg8385 (view) Author: Santoso Wijaya (santa4nt) Date: 2014-05-12.20:57:09
Oops.
msg8387 (view) Author: Michael Büsch (mb_) Date: 2014-05-13.07:48:20
This fixes it. Thanks!
msg8389 (view) Author: Jim Baker (zyasoft) Date: 2014-05-13.13:59:43
Santoso, thanks for the patch, which I have applied. Michael, thanks for the initial work on the test.

Fixed in 7244:a5b000944a51
msg8464 (view) Author: Jim Baker (zyasoft) Date: 2014-05-21.20:37:11
Part of beta 3
History
Date User Action Args
2014-05-21 20:37:11zyasoftsetstatus: pending -> closed
messages: + msg8464
2014-05-13 13:59:43zyasoftsetstatus: open -> pending
assignee: zyasoft
resolution: fixed
messages: + msg8389
nosy: + zyasoft
2014-05-13 07:48:20mb_setmessages: + msg8387
2014-05-12 20:57:09santa4ntsetfiles: + issue2140.diff
messages: + msg8385
2014-05-12 19:42:33mb_setmessages: + msg8384
2014-05-12 18:58:59santa4ntsetfiles: + issue2140.diff
keywords: + patch
messages: + msg8383
2014-05-12 18:38:06santa4ntsetnosy: + santa4nt
type: behaviour
2014-05-12 08:23:13mb_create