Silverfrost Forums

Welcome to our forums

If variable is NaN ...

3 Dec 2025 10:51 #32513

I do not remember FTN95 had NaN before.

I got corruption on harddrive or SSD (being lazy to do the entire disk formatting with check - this takes way too long now, a week or so). As a results computer trying to recover the data had read them as NAN and denormals.

How best to write IF statement to exclude them from consideration in the code?

IF(variableA.eq.NaN) goto 1000

IF(variableB.eq.denormal) goto 1000
3 Dec 2025 12:13 #32516

Version 9.10 of FTN95 supports the intrinsic module IEEE_ARITHMETIC which means that Fortran 2003 intrinsics such as IEEE_IS_NAN are available when you 'USE IEEE_ARITHMETIC'.

6 Dec 2025 2:03 #32527

Thanks, I briefly looked at that fortran 2003 NaN stuff and seems all is clear there. Also are denormal numbers treated there the same way ?

I remember FTN95 had some protective measures against denormals even way before F2003 and I used tricks against of them, if I am not mixing these with something they were like this below. I do not using them now for a long time.

        call mask_underflow@()
	call PERMIT_UNDERFLOW@(0_2)
	call PERMIT_UNDERFLOW@(.TRUE.)

If these are indeed related to the denormals can I still use them ?

Please login to reply.