Skip to content

Unexpected results from elliprj with NaN input #486

Description

@jacksonvanover

mpmath version: 1.1.0

When the fourth argument to elliprj is a NaN, the result ends up being
the product of the first three arguments. While nifty, I don't think
this is expected behavior... GSL's implementation of the same function
invokes their error handler citing a domain error which feels more
appropriate.

Example:

Python 3.6.8 (default, Oct  7 2019, 12:59:55) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from mpmath import *
>>> import numpy as np
>>> elliprj(1,2,3,4)
mpf('0.23984809974956775')
>>> elliprj(1,2,3,np.nan)
mpf('6.0')
>>> elliprj(1,3,3,np.nan)
mpf('9.0')
>>> elliprj(1,3,4,np.nan)
mpf('12.0')
>>> elliprj(0,1,4,np.nan)
mpf('0.0')

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions