Opened 10 years ago

Closed 7 years ago

Last modified 4 years ago

#9172 closed defect (worksforme)

cygwin: numerical noise in sage/rings/integer.pyx

Reported by: was Owned by: tbd
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: porting: Cygwin Keywords:
Cc: jpflori Merged in:
Authors: Reviewers: Jean-Pierre Flori
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by chapoton)

sage -t  "devel/sage/sage/rings/integer.pyx"                
**********************************************************************
File "/home/wstein/sage-4.4.3/devel/sage/sage/rings/integer.pyx", line 1681:
    sage: 2^float(1.5)       # python float
Expected:
    2.8284271247461903
Got:
    2.8284271247461898
**********************************************************************
1 items had failures:
   1 of  26 in __main__.example_42
***Test Failed*** 1 failures.
For whitespace errors, see the file /home/wstein/.sage//tmp/.doctest_integer.py
 [15.2 s]

Change History (13)

comment:1 Changed 9 years ago by drkirkby

The correct answer is 2*sqrt(2), which is 2.8284271247461900976033774484193961...

So the expected value is 2.0239x10-16 high, and result on Cygwin is 2.9760x10-16 low. So the errors on Linux/OSX/Solaris is not much lower than on Cygwin. We can't really expect any more from a floating point number.

We could change the Expected value to 2.8284271247461... What I don't like about that, is then much larger errors can exist and them not be detected. But this is far from the only such case, so I suggest just changing the test to 2.8284271247461..., which will solve this.

Dave

comment:2 Changed 8 years ago by kcrisman

This file passed doctests on a build of mine on XP.

comment:3 Changed 8 years ago by kcrisman

But when doing the test by hand, the same thing happens.

comment:4 Changed 7 years ago by kcrisman

  • Cc jpflori added
  • Priority changed from major to minor

This now fails with

2.82842712474619

which I suppose is an improvement. Maybe we can use abs tol?

comment:5 follow-up: Changed 7 years ago by jpflori

And the test passes for me (64bits W7 + 5.6.rc0).

comment:6 in reply to: ↑ 5 ; follow-up: Changed 7 years ago by kcrisman

And the test passes for me (64bits W7 + 5.6.rc0).

In which case it might just be a 32-bit versus 64-bit issue. Did you try it by hand as well?

comment:7 in reply to: ↑ 6 Changed 7 years ago by dimpase

  • Status changed from new to needs_review

Replying to kcrisman:

And the test passes for me (64bits W7 + 5.6.rc0).

In which case it might just be a 32-bit versus 64-bit issue. Did you try it by hand as well?

works for me, both ways. I think we can close this one.

comment:8 Changed 7 years ago by kcrisman

Hmm, I'm reluctant to not just change this a bit for 32-bit...

comment:9 Changed 7 years ago by jpflori

Yeah, I think we should make sure this passes on 32 bits. I'll double check when I have the time to build on such a computer.

comment:10 Changed 7 years ago by jpflori

  • Status changed from needs_review to needs_work

comment:11 Changed 7 years ago by jpflori

  • Milestone changed from sage-5.7 to sage-duplicate/invalid/wontfix
  • Status changed from needs_work to positive_review

I have no problems on my 32 bits Windows 7 install, so Cygwin must have gotten better. I really doubt Cygwin on XP would have a different behavior for this one, so let's close it.

comment:12 Changed 7 years ago by jdemeyer

  • Resolution set to worksforme
  • Reviewers set to Jean-Pierre Flori
  • Status changed from positive_review to closed

comment:13 Changed 4 years ago by chapoton

  • Description modified (diff)
Note: See TracTickets for help on using tickets.