[Rd] Use d0 instead of _8 in ppr.f ?
Martin Maechler
m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Wed Apr 29 18:47:17 CEST 2026
I had chosen _8 consciously, after reading a bit up at
constants in Fortran (in the year 2026, more than 50 years after
the 77 of 'Fortran 77') ... notably after
getting Fortran compiler warnings from flang 22.
I do think once you get very slightly used to this, using *_8 is
*faster* to parse for a human than d0 (to which many of course
has been getting used to ...).
I'm a bit sorry that this really seems to "need" an R-devel post
..., really?
Martin Maechler
>>>>> Suharto Anggono Suharto Anggono via R-devel
>>>>> on Wed, 29 Apr 2026 09:59:40 +0000 (UTC) writes:
> SVN revision 89917 adds "_8" to some numbers in src/library/stats/src/ppr.f , with message
> flang-22 wants explicit "double" / "8-bit float" constants
> How about using "d0" instead? It is more consistent within the file and a little more portable. The number doesn't have to be equal to the number of bytes, 8.
> Here is a patch that replaces "_8" with "d0".
> --- ppr.f 2026-04-29 09:39:32.145702763 +0000
> +++ ppr_d0.f 2026-04-29 09:39:32.268715531 +0000
> @@ -842,9 +842,9 @@
> data df, gcvpen, ismethod, trace /4d0, 1d0, 0, .false./
> data ifl,maxit, conv, mitone, cutmin, fdel
> - & / 6, 20, .005_8, 20, 0.1_8, 0.02_8 /
> + & / 6, 20, .005d0, 20, 0.1d0, 0.02d0 /
> data span,alpha, big, cjeps, mitcj, lf
> - & / 0.0, 0.0, 1.0e20, 0.001_8, 1, 2 /
> + & / 0.0, 0.0, 1.0e20, 0.001d0, 1, 2 /
> end
> subroutine setppr(span1, alpha1, optlevel, ism, df1, gcvpen1)
> @@ -1259,7 +1259,7 @@
> common /spans/ spans /consts/ big,sml,eps
> data spans, big, sml, eps
> - & /0.05_8, 0.2_8, 0.5, 1.0e20,1.0e-7,1.0e-3/
> + & /0.05d0, 0.2d0, 0.5, 1.0e20,1.0e-7,1.0e-3/
> end
> c---------------------------------------------------------------
> c
> @@ -1384,7 +1384,7 @@
> c tol for 'spar' estimation:
> param(3) = 1d-2
> c 'eps' (~= 2^-12 = sqrt(2^-24) ?= sqrt(machine eps)) in ./sbart.c :
> - param(4) = .000244_8
> + param(4) = .000244d0
> ier = 1
> call rbart(gcvpen,df1,dx,dy,dw,0.0d0,n,knot,nk,coef,dsmo,lev,
> This is an alternative that uses "d" for all "double precision".
> --- ppr.f 2026-04-29 09:39:32.145702763 +0000
> +++ ppr_d0_all.f 2026-04-29 09:39:32.291717918 +0000
> @@ -842,9 +842,9 @@
> data df, gcvpen, ismethod, trace /4d0, 1d0, 0, .false./
> data ifl,maxit, conv, mitone, cutmin, fdel
> - & / 6, 20, .005_8, 20, 0.1_8, 0.02_8 /
> + & / 6, 20, .005d0, 20, 0.1d0, 0.02d0 /
> data span,alpha, big, cjeps, mitcj, lf
> - & / 0.0, 0.0, 1.0e20, 0.001_8, 1, 2 /
> + & / 0d0, 0d0, 1.0d20, 0.001d0, 1, 2 /
> end
> subroutine setppr(span1, alpha1, optlevel, ism, df1, gcvpen1)
> @@ -1258,8 +1258,8 @@
> double precision spans(3), big,sml,eps
> common /spans/ spans /consts/ big,sml,eps
> - data spans, big, sml, eps
> - & /0.05_8, 0.2_8, 0.5, 1.0e20,1.0e-7,1.0e-3/
> + data spans, big, sml, eps
> + & /0.05d0, 0.2d0, 0.5d0, 1.0d20,1.0d-7,1.0d-3/
> end
> c---------------------------------------------------------------
> c
> @@ -1384,7 +1384,7 @@
> c tol for 'spar' estimation:
> param(3) = 1d-2
> c 'eps' (~= 2^-12 = sqrt(2^-24) ?= sqrt(machine eps)) in ./sbart.c :
> - param(4) = .000244_8
> + param(4) = .000244d0
> ier = 1
> call rbart(gcvpen,df1,dx,dy,dw,0.0d0,n,knot,nk,coef,dsmo,lev,
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
More information about the R-devel
mailing list