www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Compile-time floating point division

reply David Friedman <d3rdclsmail_a_ _t_earthlink_d_._t_net> writes:
The following code fails for on Linux, but not Windows.  Probable cause: 
DMD's complex_t::operator/ does not handle special cases as in 
Phobos/DMC/GNU runtime libraries.

-----------
import std.math;
double f = -1.0/0.0;
double f1 = -1.0;
double f2 = 0;
int main() {
     assert(isinf(f1/f2)); // passes
     assert(isinf(f));     // fails
     return 0;
}
----------

David
May 03 2005
parent Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David Friedman schrieb am Tue, 03 May 2005 20:39:02 -0400:
 The following code fails for on Linux, but not Windows.  Probable cause: 
 DMD's complex_t::operator/ does not handle special cases as in 
 Phobos/DMC/GNU runtime libraries.

 -----------
 import std.math;
 double f = -1.0/0.0;
 double f1 = -1.0;
 double f2 = 0;
 int main() {
      assert(isinf(f1/f2)); // passes
      assert(isinf(f));     // fails
      return 0;
 }
 ----------

 David

Added to DStress as http://dstress.kuehne.cn/run/o/opDiv_07_A.d http://dstress.kuehne.cn/run/o/opDiv_07_B.d http://dstress.kuehne.cn/run/o/opDiv_08_A.d http://dstress.kuehne.cn/run/o/opDiv_08_B.d http://dstress.kuehne.cn/run/o/opDiv_09_A.d http://dstress.kuehne.cn/run/o/opDiv_09_B.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCglm83w+/yD4P9tIRAo2/AJ9z40wVKHx1LfxhvrYwLyHYcVohUQCdFosB cwjvIlUaq6h/0qQ4e3vlgIk= =d2OR -----END PGP SIGNATURE-----
May 11 2005