I would never use a library that returns NaNs.
Considering the current Fortran standard with rudimentary to no support for this aspect, KISS will be preferable for FOSS libraries in Fortran:
FUNCTIONsubprograms: employERROR STOPfor the exceptions that, hopefully, are as such!SUBROUTINEs: includeSTATandERRMSGarguments and follow intrinsic procedures: a)STATisINTENT(OUT)and zero value meansSUCCESSand b)ERRMSGisINTENT(INOUT)