use / to detect -0.0; fix error-checking bugs
svn: r2571
This commit is contained in:
parent
7ba6ab2bb8
commit
c1ba7dc426
|
@ -613,21 +613,12 @@ double scheme_real_to_double(Scheme_Object *r)
|
|||
}
|
||||
|
||||
static
|
||||
/* Inlining seems to trip over a bug in gcc 3.4.x,
|
||||
and it's not worth the trouble.
|
||||
#ifndef NO_INLINE_KEYWORD
|
||||
# ifndef DONT_INLINE_NZERO_TEST
|
||||
MSC_IZE(inline)
|
||||
# endif
|
||||
#endif */
|
||||
#ifndef NO_INLINE_KEYWORD
|
||||
MSC_IZE(inline)
|
||||
#endif
|
||||
int minus_zero_p(double d)
|
||||
{
|
||||
/* Relies on 4-byte "int": */
|
||||
if (((int *) mzALIAS &d)[0] == ((int *) mzALIAS &scheme_floating_point_nzero)[0]
|
||||
&& ((int *) mzALIAS &d)[1] == ((int *) mzALIAS &scheme_floating_point_nzero)[1])
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
return (1 / d) < 0;
|
||||
}
|
||||
|
||||
int scheme_minus_zero_p(double d)
|
||||
|
|
|
@ -1917,7 +1917,7 @@ static Scheme_Object *real_to_bytes (int argc, Scheme_Object *argv[])
|
|||
size = SCHEME_INT_VAL(argv[1]);
|
||||
else
|
||||
size = 0;
|
||||
if ((size != 2) && (size != 4) &&(size != 8))
|
||||
if ((size != 4) && (size != 8))
|
||||
scheme_wrong_type("real->floating-point-bytes", "exact 4 or 8", 1, argc, argv);
|
||||
|
||||
if (argc > 2)
|
||||
|
|
|
@ -103,11 +103,6 @@ X_(make, string) (int argc, Scheme_Object *argv[])
|
|||
|
||||
len = scheme_extract_index("make-" XSTRINGSTR, 0, argc, argv, -1, 0);
|
||||
|
||||
if (len == -1) {
|
||||
scheme_raise_out_of_memory("make-" XSTRINGSTR, "making " XSTR "string of length %s",
|
||||
scheme_make_provided_string(argv[0], 0, NULL));
|
||||
}
|
||||
|
||||
if (argc == 2) {
|
||||
if (!CHARP(argv[1]))
|
||||
scheme_wrong_type("make-" XSTRINGSTR, CHAR_STR, 1, argc, argv);
|
||||
|
@ -115,6 +110,11 @@ X_(make, string) (int argc, Scheme_Object *argv[])
|
|||
} else
|
||||
fill = 0;
|
||||
|
||||
if (len == -1) {
|
||||
scheme_raise_out_of_memory("make-" XSTRINGSTR, "making " XSTR "string of length %s",
|
||||
scheme_make_provided_string(argv[0], 0, NULL));
|
||||
}
|
||||
|
||||
str = X(scheme_alloc, _string)(len, fill);
|
||||
return str;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user