Bug #6784

Test failures related to numeric with x64 mingw

Added by Hiroshi Shirosaki almost 2 years ago. Updated over 1 year ago.

[ruby-core:46686]
Status:Closed
Priority:Normal
Assignee:Hiroshi Shirosaki
Category:core
Target version:2.0.0
ruby -v:ruby 2.0.0dev (2012-07-23 trunk 36499) [x64-mingw32] Backport:

Description

x64 mingw build has many floating point numeric related failures in test-all.

http://ci.rubyinstaller.org/job/test-ruby-trunk-x64/24/console

2) Failure:
testplus(TestBignum) [C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/ruby/testbignum.rb:244]:
expected but was
.

3) Failure:
testsub(TestBignum) [C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/ruby/testbignum.rb:232]:
expected but was
<-2.251799813685248e+15>.

6) Failure:
testdivide(TestFixnum) [C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/ruby/testfixnum.rb:156]:
expected but was
<(1/4294967296)>.

7) Failure:
testpow2(TestFixnum) [C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/ruby/testfixnum.rb:184]:
expected but was
<(1/65536)>.

8) Failure:
testdivmod2(TestFloat) [C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/ruby/testfloat.rb:269]:
expected but was
.

9) Failure:
testroundwithprecision(TestFloat) [C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/ruby/testfloat.rb:382]:
expected but was
.

This seems cause of broken pow() implementation of x64 mingw.
Using powl() instead of pow() will fix this. I attached the patch.

I tested it with gcc version 4.6.1 (tdm64-1) on Win7.

0001-Fix-broken-pow-of-mingw.patch Magnifier (1.03 KB) Hiroshi Shirosaki, 07/24/2012 07:24 AM

Associated revisions

Revision 36522
Added by shirosaki almost 2 years ago

Fix broken pow() on x64-mingw32

  • include/ruby/win32.h (rbw32pow): add new function. We use powl() instead of broken pow() for x64-mingw32. This workaround fixes test failures related to floating point numeric. [Bug #6784]

History

#1 Updated by Luis Lavena almost 2 years ago

  • Category set to core
  • Status changed from Open to Assigned
  • Assignee changed from Luis Lavena to Nobuyoshi Nakada
  • Target version set to 2.0.0

Thank you Hiroshi,

I'm reassigning this ticket to Nobu looking for approval.

CC: Usa, do you agree with Hiroshi conclusion and solution? If so, I will commit.

Thank you.

#2 Updated by Luis Lavena almost 2 years ago

  • Assignee changed from Nobuyoshi Nakada to Hiroshi Shirosaki

=begin
Thank you Usa,

Hiroshi, see comments from Usa at :

About Hiroshi's patch, I don't think the name "fakepow" is
a good name.
We should use "rb
w32_" prefix for the published name.
I think the patch is OK except it.

Please commit variant following those suggestions (e.g. rbw32pow)
=end

#3 Updated by Usaku NAKAMURA almost 2 years ago

Hello,

In message " [ruby-trunk - Bug #6784][Assigned] Test failures related to numeric with x64 mingw"
on Jul.24,2012 08:13:27, luislavena@gmail.com wrote:

CC: Usa, do you agree with Hiroshi conclusion and solution? If so, I will commit.

I have not set up the 64bit mingw environment yet.
Therefore, I have not checked this.
However, probably, it will be the problem of mingw, since it
has not occurred in mswin.

About Hiroshi's patch, I don't think the name "fakepow" is
a good name.
We should use "rb
w32_" prefix for the published name.
I think the patch is OK except it.

Regards,
--
U.Nakamura usa@garbagecollect.jp

#4 Updated by Anonymous almost 2 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r36522.
Hiroshi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


Fix broken pow() on x64-mingw32

  • include/ruby/win32.h (rbw32pow): add new function. We use powl() instead of broken pow() for x64-mingw32. This workaround fixes test failures related to floating point numeric. [Bug #6784]

Also available in: Atom PDF