mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
win32.c: for strict ANSI
* win32/win32.c (rb_w32_pow): move from win32.h and disable strict ANSI mode macro to let _controlfp() stuff defined. [ruby-core:55312] [Bug #8495] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9487b2cdfc
commit
3d7fa44b05
3 changed files with 26 additions and 16 deletions
|
@ -1,4 +1,8 @@
|
||||||
Mon Jul 8 23:12:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Mon Jul 8 23:13:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* win32/win32.c (rb_w32_pow): move from win32.h and disable strict
|
||||||
|
ANSI mode macro to let _controlfp() stuff defined.
|
||||||
|
[ruby-core:55312] [Bug #8495]
|
||||||
|
|
||||||
* numeric.c (finite): add declaration for strict ANSI.
|
* numeric.c (finite): add declaration for strict ANSI.
|
||||||
[ruby-core:55312] [Bug #8495]
|
[ruby-core:55312] [Bug #8495]
|
||||||
|
|
|
@ -794,21 +794,7 @@ rb_w32_pow(double x, double y)
|
||||||
return powl(x, y);
|
return powl(x, y);
|
||||||
}
|
}
|
||||||
#elif defined(__MINGW64_VERSION_MAJOR)
|
#elif defined(__MINGW64_VERSION_MAJOR)
|
||||||
/*
|
double rb_w32_pow(double x, double y);
|
||||||
* Set floating point precision for pow() of mingw-w64 x86.
|
|
||||||
* With default precision the result is not proper on WinXP.
|
|
||||||
*/
|
|
||||||
static inline double
|
|
||||||
rb_w32_pow(double x, double y)
|
|
||||||
{
|
|
||||||
double r;
|
|
||||||
unsigned int default_control = _controlfp(0, 0);
|
|
||||||
_controlfp(_PC_64, _MCW_PC);
|
|
||||||
r = pow(x, y);
|
|
||||||
/* Restore setting */
|
|
||||||
_controlfp(default_control, _MCW_PC);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(__MINGW64_VERSION_MAJOR) || defined(__MINGW64__)
|
#if defined(__MINGW64_VERSION_MAJOR) || defined(__MINGW64__)
|
||||||
#define pow rb_w32_pow
|
#define pow rb_w32_pow
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
Copyright (C) 2000 Information-technology Promotion Agency, Japan
|
Copyright (C) 2000 Information-technology Promotion Agency, Japan
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#undef __STRICT_ANSI__
|
||||||
|
|
||||||
#include "ruby/ruby.h"
|
#include "ruby/ruby.h"
|
||||||
#include "ruby/encoding.h"
|
#include "ruby/encoding.h"
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -6954,3 +6956,21 @@ rb_w32_unwrap_io_handle(int fd)
|
||||||
}
|
}
|
||||||
return _close(fd);
|
return _close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(__MINGW64__) && defined(__MINGW64_VERSION_MAJOR)
|
||||||
|
/*
|
||||||
|
* Set floating point precision for pow() of mingw-w64 x86.
|
||||||
|
* With default precision the result is not proper on WinXP.
|
||||||
|
*/
|
||||||
|
double
|
||||||
|
rb_w32_pow(double x, double y)
|
||||||
|
{
|
||||||
|
double r;
|
||||||
|
unsigned int default_control = _controlfp(0, 0);
|
||||||
|
_controlfp(_PC_64, _MCW_PC);
|
||||||
|
r = pow(x, y);
|
||||||
|
/* Restore setting */
|
||||||
|
_controlfp(default_control, _MCW_PC);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue