Re: size of long on all supported arches

From: Nuno Teixeira <eduardo_at_freebsd.org>
Date: Fri, 19 Apr 2024 08:11:08 UTC
(...)

If anyone wants to test, I've included patch in commit:
https://cgit.freebsd.org/ports/commit/?id=89e4a1f2c1d1997b8414e2e648c7b4b7c829b63e

Nuno Teixeira <eduardo@freebsd.org> escreveu (sexta, 19/04/2024 à(s) 08:29):

> Hello all,
>
> I'm testing a fix for tests on a R port (math/R-cran-RcppArmadillo):
> https://github.com/RcppCore/RcppArmadillo/issues/408
>
> Resuming: test is failing because "tolerance" needs to get adjusted to
> work:
>
> ---- FAILED[data]: test_cube.R<44--45>
>    call| expect_equivalent(cx_fcube_test(cplx_cube), (cplx_cube^2), tolerance = critTol)
>    diff| Mean relative Mod difference: 1.512537e-07
>   ----- FAILED[data]: test_cube.R<81--82>
>    call| expect_equivalent(as_cx_fcube(cplx_cube), (cplx_cube^2), tolerance = critTol)
>    diff| Mean relative Mod difference: 1.512537e-07
>   Error: 2 out of 314 tests failed
>
> is fixed by patching:
>
>  .onWindows <- .Platform$OS.type == "windows"
> -critTol <- if (.onWindows) 1.0e-6 else 1.5e-7
> +critTol <- if (.onWindows || .Machine$sizeof.long == 4 ||
> .Machine$sizeof.long == 8) 1.0e-6 else 1.5e-7
>
> i.e., setting "tolerance" to 1.0e-6 value, test is ok (on systems bellow)
>
> With my hardware i7 and rpi4 I noted that long are:
>
> amd64   .Machine$sizeof.long == 8
> i386    .Machine$sizeof.long == 4
> aarch64 .Machine$sizeof.long == 8
> armv7   .Machine$sizeof.long == 4
>
> and suppose that is the same to all 32/64 bit supported systems?
>
> Upstream are sugesting using OS agnostic check to fix test, so, any better
> approach or sugestion is welcome.
>
> Thanks :)
>
> --
> Nuno Teixeira
> FreeBSD Committer (ports)
>


-- 
Nuno Teixeira
FreeBSD UNIX:  <eduardo@FreeBSD.org>   Web:  https://FreeBSD.org