@@ -14,10 +14,17 @@ getVaW <- function(expr) {
14
14
invokeRestart(" muffleWarning" ) })
15
15
structure(val , warning = W )
16
16
}
17
+ (sysinf <- Sys.info())
18
+ Lnx <- sysinf [[" sysname" ]] == " Linux"
19
+ isMac <- sysinf [[" sysname" ]] == " Darwin"
20
+ arch <- sysinf [[" machine" ]]
21
+ x86 <- arch == " x86_64"
17
22
onWindows <- .Platform $ OS.type == " windows"
18
- .M <- .Machine
19
- str(.M [grep(" ^sizeof" , names(.M ))]) # # also differentiate long-double..
20
- b64 <- .M $ sizeof.pointer == 8
23
+ str(.Machine [grep(" ^sizeof" , names(.Machine ))]) # # also differentiate long-double..
24
+ (b64 <- .Machine $ sizeof.pointer == 8L )
25
+ (noLdbl <- .Machine $ sizeof.longdouble < = 8L ) # # TRUE when --disable-long-double
26
+ (longD16 <- .Machine $ sizeof.longdouble > = 16L )
27
+
21
28
options(nwarnings = 10000 , # (rather than just 50)
22
29
width = 99 ) # instead of 80
23
30
@@ -2772,7 +2779,6 @@ spois <- summary( poisfit)
2772
2779
sqpois <- summary(qpoisfit )
2773
2780
sqpois.d1 <- summary(qpoisfit , dispersion = 1 )
2774
2781
SE1 <- sqrt(diag(V <- vcov(poisfit )))
2775
- (noLdbl <- (.Machine $ sizeof.longdouble < = 8 )) # # TRUE when --disable-long-double
2776
2782
stopifnot(exprs = { # # Same variances and same as V
2777
2783
all.equal(vcov(spois ), V )
2778
2784
all.equal(vcov(qpoisfit , dispersion = 1 ), V ) # # << was wrong
@@ -4886,10 +4892,11 @@ for(i.n in seq_along(ns)) {
4886
4892
stopifnot(abs(rr - 1 ) < 3.3 / ns )
4887
4893
# # many of these pretty() calls errored (because internally gave Inf) in R <= 4.1.0
4888
4894
# #
4895
+
4889
4896
# #---------------- very small ranges ------------------
4890
4897
# # The really smallest positive number (unless subnormals do "not exist"):
4891
4898
mm <- with(.Machine , double.xmin * double.eps )
4892
- log2(mm ) == - 1074 # T
4899
+ log2(mm ) == - 1074 # TRUE (everywhere ??)
4893
4900
# # "of course", this an extreme *sub normal* number, e.g.
4894
4901
mm == c(0.50001 , 1.49999 ) * mm # TRUE TRUE (!)
4895
4902
(1.5 * mm ) / mm # 2 (!!)
@@ -4904,23 +4911,49 @@ fsS <- fs[fs <= 0.75]
4904
4911
options(warn = 0 ) # (collect warnings)
4905
4912
psmm <- lapply(h.u , function (hu )
4906
4913
lapply(fsS , function (f )
4907
- lapply(nns , pretty , x = c(0 , mm / f ), high.u = hu , eps.correction = 2 )))
4908
- summary(warnings())# # many; mostly "very small range 'cell'=0 , corrected to 2.122e-314"
4914
+ lapply(nns , pretty , x = c(0 , mm / f ), high.u.bias = hu )))
4915
+ summary(warnings())# # many "very small range 'cell'=<nnn>e+32<n> , corrected to 2.122e-314"
4909
4916
(T <- table(psA <- unlist(psmm ))) # is this portable?
4910
4917
(nT <- as.numeric(names(T )))
4911
4918
range(rEd <- abs(2e-314 / diff(nT ) - 1 ))
4912
- stopifnot(nT > = 0 , length(nT ) == 11 ,
4913
- rEd < = 2 ^- 50 ) # only seen rEd == 0
4914
- # #
4919
+ stopifnot(exprs = {
4920
+ nT > = 0
4921
+ (nn <- length(nT )) < = 15 # always = 11 on Lnx 64b
4922
+ 7 < = nn
4923
+ rEd < = if (b64 ) 2 ^- 50 else 0.9 # Lnx 64b: only seen rEd == 0; 32bit ppc : 0.8 (!)
4924
+ })
4925
+ # # This used to be _very_ slow in R <= 4.5.1 because it produced _HUGE_ (non-pretty!) vectors;
4926
+ # # On Linux, an OS daemon would typically kill the R process for using too much resources:
4927
+ psm2 <- lapply(h.u , function (hu ) {
4928
+ # # cat(sprintf("hu:%6g -- f =", hu)); on.exit(cat("\n"))
4929
+ lapply(fsS , function (f ) {
4930
+ # # cat(sprintf(" %g", f))
4931
+ lapply(nns , \(n ) pretty(c(0 , mm / f ), n = n , high.u.bias = hu , eps.correct = 2 ))
4932
+ })
4933
+ })
4934
+ apply(sapply(psmm , \(L ) sapply(L ,lengths )), 2L , quantile )
4935
+ apply(sapply(psm2 , \(L ) sapply(L ,lengths )), 2L , quantile )
4915
4936
psmm.o <- lapply(h.u , function (hu )
4916
4937
lapply(fsS , function (f ) # older R: f.min = 20 hardwired:
4917
4938
lapply(nns , pretty , x = c(0 , mm / f ), high.u = hu , f.min = 20 ) ))
4918
4939
summary(warnings())# # many; mostly "very small range 'cell'=0, corrected to 4.45015e-307"
4919
4940
(To <- table(psAo <- signif(unlist(psmm.o ), 13 )))
4920
4941
(nTo <- as.numeric(names(To )))
4921
- range(rEdo <- abs(5e-307 / diff(nTo ) - 1 ))
4922
- stopifnot(nTo > = 0 , length(nTo ) == 11 ,
4923
- rEdo < = 2 ^- 44 ) # seen max of 2^-51 on Lnx_64; 2^-44.5 on Win64
4942
+ range(rEdo <- abs(5e-307 / diff(nTo ) - 1 )) # 0 2.33e-15
4943
+ r1 <- apply(sapply(psmm , \(L ) sapply(L ,lengths )), 2L , range )
4944
+ r2 <- apply(sapply(psm2 , \(L ) sapply(L ,lengths )), 2L , range )
4945
+ r3 <- apply(sapply(psmm.o ,\(L ) sapply(L ,lengths )), 2L , range )
4946
+ stopifnot(exprs = {
4947
+ nTo > = 0
4948
+ (nn <- length(nTo )) < = 15 # # length(nTo) == 11
4949
+ 7 < = nn
4950
+ rEdo < = if (b64 ) 2 ^- 44 else 0.9 # Lnx 64b: seen max of 2^-48.608 (prev. 2^-51) Lnx_64; 2^-44.5 on Win64; ppc ??
4951
+ if (b64 && x86 ) { # # platform ?
4952
+ r1 == c(2 , 11 )
4953
+ r2 == c(3 , 11 )
4954
+ r3 == c(1 , 11 )
4955
+ } else TRUE
4956
+ })
4924
4957
4925
4958
4926
4959
# # graphics::axis(), but also *engine* GScale() / GPretty() etc
0 commit comments