work around modulo
failure on 64-bit Windows with MSVC 2008
Something about loading the MinGW-built "londdouble.dll" interferes with fmod() in some cases --- but only on the first call?
This commit is contained in:
parent
91eaf40b1f
commit
153e19edc5
|
@ -998,6 +998,8 @@
|
||||||
(test 0.0 modulo -4.0 2)
|
(test 0.0 modulo -4.0 2)
|
||||||
(test 0.0 modulo 4.0 -2)
|
(test 0.0 modulo 4.0 -2)
|
||||||
(test 0.0 modulo -4.0 -2)
|
(test 0.0 modulo -4.0 -2)
|
||||||
|
(test 1.0 modulo 21.0 2)
|
||||||
|
(test 1.0 modulo -21.0 2)
|
||||||
(test 0 remainder 4 2)
|
(test 0 remainder 4 2)
|
||||||
(test 0 remainder -4 2)
|
(test 0 remainder -4 2)
|
||||||
(test 0 remainder 4 -2)
|
(test 0 remainder 4 -2)
|
||||||
|
@ -1006,6 +1008,8 @@
|
||||||
(test 0.0 remainder -4.0 2)
|
(test 0.0 remainder -4.0 2)
|
||||||
(test 0.0 remainder 4.0 -2)
|
(test 0.0 remainder 4.0 -2)
|
||||||
(test 0.0 remainder -4.0 -2)
|
(test 0.0 remainder -4.0 -2)
|
||||||
|
(test 1.0 remainder 21.0 2)
|
||||||
|
(test -1.0 remainder -21.0 2)
|
||||||
(test 0 modulo 0 5.0)
|
(test 0 modulo 0 5.0)
|
||||||
(test 0 modulo 0 -5.0)
|
(test 0 modulo 0 -5.0)
|
||||||
(test 0 remainder 0 5.0)
|
(test 0 remainder 0 5.0)
|
||||||
|
|
|
@ -1762,7 +1762,10 @@
|
||||||
e)
|
e)
|
||||||
(= 1 (hash-ref used-symbols
|
(= 1 (hash-ref used-symbols
|
||||||
(let loop ([e e])
|
(let loop ([e e])
|
||||||
(if (null? (cddr e))
|
(if (or (null? (cddr e))
|
||||||
|
(and (pair? (cdr e))
|
||||||
|
(eq? '= (tok-n (cadr e)))
|
||||||
|
(= (length e) 4)))
|
||||||
(tok-n (car e))
|
(tok-n (car e))
|
||||||
(loop (cdr e))))))))
|
(loop (cdr e))))))))
|
||||||
|
|
||||||
|
|
|
@ -856,6 +856,8 @@ static void make_kernel_env(void)
|
||||||
scheme_init_print_global_constants();
|
scheme_init_print_global_constants();
|
||||||
scheme_init_variable_references_constants();
|
scheme_init_variable_references_constants();
|
||||||
|
|
||||||
|
scheme_init_longdouble_fixup();
|
||||||
|
|
||||||
scheme_defining_primitives = 0;
|
scheme_defining_primitives = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1568,6 +1568,24 @@ void scheme_init_extfl_unsafe_number(Scheme_Env *env)
|
||||||
scheme_add_global_constant("unsafe-f80vector-set!", p, env);
|
scheme_add_global_constant("unsafe-f80vector-set!", p, env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
/* Something about loading "longdouble.dll" can interfere with
|
||||||
|
fmod() so that it fails on a first call, but works on subsequent
|
||||||
|
calls. The issue doesn't seem to be as simple as the floating-point
|
||||||
|
control state, it seems to affect mainly MSVC 2008 builds, only
|
||||||
|
the 3m build, etc. Using a non-static variable ensures that the
|
||||||
|
compiler doesn't optimize away the call to fmod(). */
|
||||||
|
double scheme_longdouble_fixup_hack = 4;
|
||||||
|
void scheme_init_longdouble_fixup(void)
|
||||||
|
{
|
||||||
|
scheme_longdouble_fixup_hack = fmod(scheme_longdouble_fixup_hack, 2.0);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void scheme_init_longdouble_fixup(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Scheme_Object *
|
Scheme_Object *
|
||||||
scheme_make_integer_value(intptr_t i)
|
scheme_make_integer_value(intptr_t i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -387,6 +387,7 @@ void scheme_init_parameterization();
|
||||||
void scheme_init_getenv(void);
|
void scheme_init_getenv(void);
|
||||||
void scheme_init_inspector(void);
|
void scheme_init_inspector(void);
|
||||||
void scheme_init_compenv_symbol(void);
|
void scheme_init_compenv_symbol(void);
|
||||||
|
void scheme_init_longdouble_fixup(void);
|
||||||
|
|
||||||
#ifndef DONT_USE_FOREIGN
|
#ifndef DONT_USE_FOREIGN
|
||||||
void scheme_init_foreign_globals();
|
void scheme_init_foreign_globals();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user