Opened 9 years ago

Last modified 8 years ago

#14392 new defect

Domain error with tgammal when using FreeBSD

Reported by: stephen Owned by: pjeremy
Priority: minor Milestone: sage-6.4
Component: porting: BSD Keywords: cephes, FreeBSD
Cc: jpflori Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

I tested sage-5.9.beta2 and got errors like this:

"sage -t devel/sage/sage/plot/plot.py"

**********************************************************************
File "devel/sage/sage/plot/plot.py", line 942, in sage.plot.plot.plot
Failed example:
    plot(gamma, (-3, 4), detect_poles = True).show(ymin = -5, ymax = 5)
Expected nothing
Got:
    <BLANKLINE>
    tgammal domain error
**********************************************************************
File "devel/sage/sage/plot/plot.py", line 946, in sage.plot.plot.plot
Failed example:
    plot(gamma, (-3, 4), detect_poles = 'show').show(ymin = -5, ymax = 5)
Expected nothing
Got:
    <BLANKLINE>
    tgammal domain error

This is because FreeBSD uses the cephes math libraries. These output error messages to stdout when they shouldn't.

The following patch removes all the print statements from files called mtherror.c in cephes.

--- cephes-2.8.p1/spkg-install-orig     2013-03-30 20:48:35.000000000 +0000
+++ cephes-2.8.p1/spkg-install  2013-03-30 20:48:57.000000000 +0000
@@ -24,6 +24,8 @@
     fi
 done

+sed -i .orig 's|.*printf|//&1|' */mtherr.c
+
 echo "Building Cephes..."
 $MAKE
 if [ $? -ne 0 ]; then

Change History (9)

comment:1 follow-up: Changed 9 years ago by kcrisman

I like this idea, but I'm not sure whether this is what we should do. It might be better to use a sed script as above to make the changes, then to create a patch we can apply based on that.

comment:2 Changed 9 years ago by stephen

I don't mind using an explicit patch. I was just trying to indicate where the error took place.

In some sense it is a bandaid fix. But then the whole cephes library is a bandaid fix.

comment:3 Changed 9 years ago by kcrisman

Great, perhaps I will get around to making this patch sometime. You are right about cephes, I suppose, but numerical issues are somewhat beyond my ken.

comment:4 in reply to: ↑ 1 Changed 9 years ago by jdemeyer

Replying to kcrisman:

It might be better to use a sed script as above to make the changes, then to create a patch we can apply based on that.

I agree. Document the sed script in SPKG.txt, but apply a patch in spkg-install.

comment:5 Changed 9 years ago by jpflori

  • Cc jpflori added

comment:6 Changed 9 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:7 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:8 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:9 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4
Note: See TracTickets for help on using tickets.