* mini-x86.c (mono_arch_output_basic_block): Handle negative zero
correctly.
* basic-float.cs: Added tests for negative zero.
svn path=/trunk/mono/; revision=14512
+2003-05-12 Zoltan Varga <vargaz@freemail.hu>
+
+ * mini-x86.c (mono_arch_output_basic_block): Handle negative zero
+ correctly.
+
+ * basic-float.cs: Added tests for negative zero.
Sun May 11 14:56:27 CEST 2003 Paolo Molaro <lupus@ximian.com>
return 4;
}
+ static unsafe int test_2_negative_zero () {
+ int result = 0;
+ double d = -0.0;
+ float f = -0.0f;
+
+ byte *ptr = (byte*)&d;
+ if (ptr [7] == 0)
+ return result;
+ result ++;
+
+ ptr = (byte*)&f;
+ if (ptr [3] == 0)
+ return result;
+ result ++;
+
+ return result;
+ }
static int test_15_float_cmp () {
double a = 2.0;
*/
#include "mini.h"
#include <string.h>
+#include <math.h>
#include <mono/metadata/appdomain.h>
#include <mono/metadata/debug-helpers.h>
case OP_R8CONST: {
double d = *(double *)ins->inst_p0;
- if (d == 0.0) {
+ if ((d == 0.0) && (signbit (d) == 0)) {
x86_fldz (code);
} else if (d == 1.0) {
x86_fld1 (code);
case OP_R4CONST: {
float f = *(float *)ins->inst_p0;
- if (f == 0.0) {
+ if ((f == 0.0) && (signbit (f) == 0)) {
x86_fldz (code);
} else if (f == 1.0) {
x86_fld1 (code);