Displaying 6 results from an estimated 6 matches for "r_sqrt".
Did you mean:
_sqrt
2015 Sep 14
3
Optimization bug when byte compiling with gcc 5.2.0 on windows
When building R-devel with gcc 5.2.0 (mingw-w64 v4) on Windows, make
check fails reg-tests-1b.R at the following check:
x <- c(1:2, NA)
sx <- sd(x)
!is.nan(sx)
Here 'sx' should be 'NA' but it is 'NaN'. It turns out this problem
only appears when the function is byte compiled with optimization
level 3:
mysd <- function (x, na.rm = FALSE)
sqrt(var(if
2015 Sep 14
1
Optimization bug when byte compiling with gcc 5.2.0 on windows
...stead of
isnan(). This is very similar to the problem we have for R_pow() where
we need to use powl() instead of pow() for recent versions mingw-w64
(this still needs to be patched in r-devel).
So the full solution is:
#if (defined(_WIN32) || defined(_WIN64)) && defined(__GNUC__)
# define R_sqrt(x) (isnanl(x) ? x : sqrt(x))
#else
# define R_sqrt sqrt
#endif
Below the relevant mingw-w64 sources:
https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-crt/math/isnan.c
https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-crt/math/isnanf.c
https://github.com/Alexpux/mingw-w64/blob/m...
2015 Sep 14
2
Optimization bug when byte compiling with gcc 5.2.0 on windows
...> I believe the issue is that on Windows the sqrt function when called
> with a NaN does not return the same NaN, as it does on other platforms.
> We have
>
> #if (defined(_WIN32) || defined(_WIN64)) && defined(__GNUC__) && \
> __GNUC__ <= 4
> # define R_sqrt(x) (ISNAN(x) ? x : sqrt(x))
> #else
> # define R_sqrt sqrt
> #endif
>
> for implementing the SQRT opcode. I suspect this came from Duncan
> Murdoch; I don't know the reason for restricting to __GNUC__ <= 4.
That was an update to keep the workaround for gcc 4.9.2. The prev...
2016 Apr 04
5
Optimization bug when byte compiling with gcc 5.3.0 on windows
...) 5.3.1 20160228
I've attached two patches that I needed, described below. I hope this is
the appropriate place and way to suggest patches. Comments for improvements
are very welcome.
0005-Win32-Extend-sqrt-NA_real_-hack-to-all-GCC-versions.patch
Removes the __GNUC__ <= 4 for Windows ISNAN R_sqrt hack and doesn't replace
it with any version check since I don't see any reason to second-guess when
it might be fixed. When it is fixed in MinGW-w64 we can just remove the
hack and be happy (I would hope to be able to get round to this in the next
few months).
0006-Win32-GCC-5.3-Fix-ISNAN...
2015 Sep 14
0
Optimization bug when byte compiling with gcc 5.2.0 on windows
I believe the issue is that on Windows the sqrt function when called
with a NaN does not return the same NaN, as it does on other platforms.
We have
#if (defined(_WIN32) || defined(_WIN64)) && defined(__GNUC__) && \
__GNUC__ <= 4
# define R_sqrt(x) (ISNAN(x) ? x : sqrt(x))
#else
# define R_sqrt sqrt
#endif
for implementing the SQRT opcode. I suspect this came from Duncan
Murdoch; I don't know the reason for restricting to __GNUC__ <= 4. I
seem to recall that there are other places in the code where we have
similar workarounds but I...
2016 Apr 04
0
Optimization bug when byte compiling with gcc 5.3.0 on windows
...revision it's based on. You then upload it to bugs.r-project.org, along
with a description of the problem it solves, and mark it as a bug fix or
enhancement request.
>
> 0005-Win32-Extend-sqrt-NA_real_-hack-to-all-GCC-versions.patch
> Removes the __GNUC__ <= 4 for Windows ISNAN R_sqrt hack and doesn't replace
> it with any version check since I don't see any reason to second-guess when
> it might be fixed. When it is fixed in MinGW-w64 we can just remove the
> hack and be happy (I would hope to be able to get round to this in the next
> few months).
I can se...