From: W van den Bos Date: 2010-12-01T21:46:11+09:00 Subject: [ruby-core:33503] [Ruby 1.9-Bug#4105][Open] Bug in numeric.c for Borland compiler Bug #4105: Bug in numeric.c for Borland compiler http://redmine.ruby-lang.org/issues/show/4105 Author: W van den Bos Status: Open, Priority: Low Category: core, Target version: 1.9.1 ruby -v: ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-mswin32] 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 :-) ---------------------------------------- http://redmine.ruby-lang.org