Project

General

Profile

Actions

Bug #6784

closed

Test failures related to numeric with x64 mingw

Added by h.shirosaki (Hiroshi Shirosaki) over 12 years ago. Updated about 12 years ago.

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

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

  1. Failure:
    test_plus(TestBignum) [C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/ruby/test_bignum.rb:244]:
    <2535301200456458802993406410752> expected but was
    <2.535301200456461e+30>.

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

  3. Failure:
    test_divide(TestFixnum) [C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/ruby/test_fixnum.rb:156]:
    <2.328306436538698e-10> expected but was
    <(1/4294967296)>.

  4. Failure:
    test_pow2(TestFixnum) [C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/ruby/test_fixnum.rb:184]:
    <1.5258789062500007e-05> expected but was
    <(1/65536)>.

  5. Failure:
    test_divmod2(TestFloat) [C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/ruby/test_float.rb:269]:
    <4294967296> expected but was
    <4294967295>.

  6. Failure:
    test_round_with_precision(TestFloat) [C:/Users/Worker/Jenkins/workspace/git-ruby-trunk/test/ruby/test_float.rb:382]:
    <1.1> expected but was
    <1.0999999999999999>.

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.


Files

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

Updated by luislavena (Luis Lavena) over 12 years ago

  • Category set to core
  • Status changed from Open to Assigned
  • Assignee changed from luislavena (Luis Lavena) to nobu (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.

Updated by luislavena (Luis Lavena) over 12 years ago

  • Assignee changed from nobu (Nobuyoshi Nakada) to h.shirosaki (Hiroshi Shirosaki)

=begin
Thank you Usa,

Hiroshi, see comments from Usa at [ruby-core:46694]:

About Hiroshi's patch, I don't think the name "fake_pow" 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. rb_w32_pow)
=end

Updated by usa (Usaku NAKAMURA) over 12 years ago

Hello,

In message "[ruby-core:46690] [ruby-trunk - Bug #6784][Assigned] Test failures related to numeric with x64 mingw"
on Jul.24,2012 08:13:27, 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 "fake_pow" 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

Actions #4

Updated by Anonymous over 12 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 (rb_w32_pow): add new function.
    We use powl() instead of broken pow() for x64-mingw32. This workaround
    fixes test failures related to floating point numeric.
    [ruby-core:46686] [Bug #6784]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0