Project

General

Profile

Actions

Bug #4105

closed

Bug in numeric.c for Borland compiler

Added by wvdbos (W van den Bos) almost 14 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-mswin32]
Backport:
[ruby-core:33503]

Description

=begin
There is a potential bug in Init_Numeric()

#elif defined(BORLANDC)
/* Turn off floating point exceptions for overflow, etc. */
_control87(MCW_EM, MCW_EM);
#endif

This call wil set the coprocessor in a state that double floating point will become single float when an exception is thrown

See http://qc.embarcadero.com/wc/qcmain.aspx?d=32483 for the workaround.

The next code should eleminate this

#elif defined(BORLANDC)
/* Turn off floating point exceptions for overflow, etc. */
_control87(MCW_EM, MCW_EM);
_control87(_control87(0,0),0x1FFF);
#endif

This will only appear when borland and for example microsoft dll's are mixed.
This can happend when OpenGl dll's are used

Btw. This source is also present in 1.8

I found this problem because I created a borland dll calling the ruby mswin32 version dll
It generated strange errors. A 'puts 0.0' generated a devide by zero in the ruby sprintf implementation
Putting the two _control87 calls in my dll solved this.
I found the same construction in the Ruby source without the second _control87 call :-)
=end

Actions #1

Updated by kosaki (Motohiro KOSAKI) almost 14 years ago

=begin

This will only appear when borland and for example microsoft dll's are mixed.
This can happend when OpenGl dll's are used

Btw. This source is also present in 1.8

I found this problem because I created a borland dll calling the ruby mswin32 version dll
It generated strange errors. A 'puts 0.0' generated a devide by zero in the ruby sprintf implementation
Putting the two _control87 calls in my dll solved this.
I found the same construction in the Ruby source without the second _control87 call :-)

Hi

Can you please consider to send a patch? I don't think mainainers have
borland compiler. ;)

=end

Actions #2

Updated by usa (Usaku NAKAMURA) almost 14 years ago

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

=begin
This issue was solved with changeset r29998.
W, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0