I found the only post about using the SPACING function 10 years ago noticeable numerical error - #4 by MatColgrove
When will Floating point manipulation functions support, such as spacing, be implemented?
This function is critically useful when applied in single precision gpu computing, , introduced in the fortran 90 standard.
I believe we’ve supported SPACING since we started supporting F90, which is was sometime in the mid-2000s. Also, I didn’t mention SPACING in my post, that was a user who posted after mine.
Is there a specific issue you’re encountering?
% cat spacing.f90
INTEGER, PARAMETER :: SGL = SELECTED_REAL_KIND(p=6, r=37)
INTEGER, PARAMETER :: DBL = SELECTED_REAL_KIND(p=13, r=200)
WRITE(*,*) spacing(1.0_SGL) ! "1.1920929E-07" on i686
WRITE(*,*) spacing(1.0_DBL) ! "2.220446049250313E-016" on i686
% nvfortran spacing.f90 -V21.9; a.out
Oh, I’m sorry. I didn’t find this function in the nvfortran manual and thought it wasn’t implemented.
We used to as part of our Fortran Reference Guide but stopped publishing this guide when we rebranded from PGI to NVHPC.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.