Opened 14 years ago

Closed 14 years ago

#5748 closed defect (fixed)

[with patch, positive review] Sage 3.4.1.rc2: isinf() related doctest failure in sage/rings/infinity.py

Reported by: mabshoff Owned by: mabshoff
Priority: blocker Milestone: sage-3.4.1
Component: doctest coverage Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

Notice the following on OSX and Solaris:

bsd:sage-3.4.1.rc2 mabshoff$ ./sage -t  devel/sage/sage/rings/infinity.py
sage -t  "devel/sage/sage/rings/infinity.py"                
**********************************************************************
File "/Users/mabshoff/sage-3.4.1.rc2/devel/sage/sage/rings/infinity.py", line 408:
    sage: CDF(-infinity)
Expected:
    -infinity
Got:
    +infinity
**********************************************************************

IIRC there was an analog problem in the GSL when using isinf() on OSX and Solaris due to the system's math library having a bug.

Cheers,

Michael

Attachments (1)

trac_5748.2.patch (995 bytes) - added by mabshoff 14 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 14 years ago by mabshoff

We should use GSL to determine if the double is +infinity or -infinity. It fixes the problem on OSX for GSL's printing, etc:

int
gsl_isinf (const double x)
{
  int fpc = _fpclass(x);

  if (fpc == _FPCLASS_PINF)
    return +1;
  else if (fpc == _FPCLASS_NINF)
    return -1;
  else 
    return 0;
}

We should also take a look at sage/rings/real_double.pyx where cwitty does this clever thing:

        """
        cdef int isinf = gsl_isinf(self._value)
        cdef bint isnan = gsl_isnan(self._value)

Cheers,

Michael

Changed 14 years ago by mabshoff

Attachment: trac_5748.2.patch added

comment:2 Changed 14 years ago by cwitty

Summary: Sage 3.4.1.rc2: isinf() related doctest failure in sage/rings/infinity.py[with patch, positive review] Sage 3.4.1.rc2: isinf() related doctest failure in sage/rings/infinity.py

Code looks good, doctests pass. Positive review.

comment:3 Changed 14 years ago by mabshoff

Resolution: fixed
Status: newclosed

Merged in Sage 3.4.1.rc3.

Cheers,

Michael

Note: See TracTickets for help on using tickets.