Skip to content

math.isfinite fails with Decimal sNAN #63041

Closed

Description

@stevendaprano
BPO 18841
Nosy @rhettinger, @facundobatista, @mdickinson, @stevendaprano, @skrah

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2016-05-06.12:35:27.081>
created_at = <Date 2013-08-26.15:38:40.605>
labels = ['type-bug', 'library', 'docs']
title = 'math.isfinite fails with Decimal sNAN'
updated_at = <Date 2016-05-06.12:35:27.080>
user = 'https://github.com/stevendaprano'

bugs.python.org fields:

activity = <Date 2016-05-06.12:35:27.080>
actor = 'berker.peksag'
assignee = 'docs@python'
closed = True
closed_date = <Date 2016-05-06.12:35:27.081>
closer = 'berker.peksag'
components = ['Documentation', 'Library (Lib)']
creation = <Date 2013-08-26.15:38:40.605>
creator = 'steven.daprano'
dependencies = []
files = []
hgrepos = []
issue_num = 18841
keywords = []
message_count = 4.0
messages = ['196213', '224662', '224928', '229309']
nosy_count = 7.0
nosy_names = ['rhettinger', 'facundobatista', 'mark.dickinson', 'steven.daprano', 'skrah', 'docs@python', 'BreamoreBoy']
pr_nums = []
priority = 'normal'
resolution = 'wont fix'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue18841'
versions = ['Python 3.4']

Activity

  1. stevendaprano commented on Aug 26, 2013

    @stevendaprano
    MemberAuthor

    math.isfinite currently raises ValueError when given a Decimal sNAN (signalling NAN).

    I've run into a situation where I'm calling isfinite() on a numeric value which may be a Decimal sNAN, and it would be nice if it returned False.

    On the other hand, see the discussion on bpo-15544, which possibly leads to the conclusion that raising ValueError is the right thing to do.

    http://bugs.python.org/issue15544

    Either way, behaviour should be documented.

  2. added
    docsDocumentation in the Doc dir
    stdlibStandard Library Python modules in the Lib/ directory
    type-bugAn unexpected behavior, bug, or error
    on Aug 26, 2013
  3. BreamoreBoy commented on Aug 3, 2014

    BreamoreBoymannequin
    Mannequin

    Steven, can you propose a patch for this?

  4. mdickinson commented on Aug 6, 2014

    @mdickinson
    Member

    Mark: it's not really ready for a patch, since there's no agreement yet on how best to solve this. In fact, I'm tempted to close as "wont fix": the argument is that the math module consists for the most part only of thin wrappers around the platform math library.

    The underlying need (as far as I understand it) is to be able to tell whether a given number is a nan or not without having to know in advance whether it's a float, int or Decimal instance. There may be other ways of achieving this goal (like adding an is_nan method to float and int, for example.)

  5. skrah commented on Oct 14, 2014

    skrahmannequin
    Mannequin

    "Wont fix" sounds good to me.

  6. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions