[SAC-HELP] detecting "inf" and "nan" in sac

Igor Stubailo stubailo at gmail.com
Thu Aug 18 11:02:23 PDT 2011


Hello,

This is a follow up question I asked below.

I found a reference to isnan() call at
http://www.iris.washington.edu/pipermail/sac-dev/2008-January/000058.html
that says:
          BUG FIX: isNaN() unsuitable for double, changed to system
	  command isnan().  Found while checking polezero constants.

Is is possible to use isnan() and isinf() in a sac macro directly or indirectly?

How else could I detect the nan and inf while in macro? It seems that
the if loop below doesn't do a job (at least for me).

I know I can implement this function in fortran through readsac1 but I
am trying to write this in sac a macro only.
Would you recommend not to do it for whatever reason?

Thank you,
Igor


On Tue, Aug 16, 2011 at 10:53 PM, Igor Stubailo <stubailo at gmail.com> wrote:
> Hello,
>
> Is there any way to detect a non-number value (like inf and nan) in an if loop?
> I couldn't find any references to this in the manual.
> All versions below are simply ignored by sac:
>
> mtw %min %max
> rms to user0
> setbb sta &1,user0
>
> *** doesn't work:
> if %sta eq inf
> message "***** not a number  ******"
> endif
>
> *** doesn't work:
> if %sta eq "inf"
> message "***** not a number  ******"
> endif
>
>
> Note, this works:
> if %sta eq 0
> message "***** detected zero ******"
> endif
>
> Thanks,
> Igor
>




More information about the sac-help mailing list