cancel
Showing results for 
Search instead for 
Did you mean: 

NANQ

 
R Samantaray_1
Occasional Visitor

NANQ

I do math calculation in OpenVMS I64. Many a time it is due to divided by zero, sqrt of -VE number etc. How to stop the application without proceeding further? In general how to handle it?
4 REPLIES 4
Steven Schweda
Honored Contributor

Re: NANQ

Patient: "Doctor, it hurts when I do this."
Doctor: "Don't do that."

> I do math calculation in OpenVMS I64. [...]

Language? VMS is a big place.

> In general how to handle it?

"In general" is also a big place.

Many programming languages offer an "if"
statement, which can be used to check for
valid data before performing any calculation
which has an obvious restriction on its
domain.

Alternatively, in many environments, one can
establish an exception/signal handler,
letting a program's execution path change
when a math error occurs.

HELP CRTL signal
HELP RTL_ROUTINES LIB$ LIB$ESTABLISH
[...]
Joseph Huber_1
Honored Contributor

Re: NANQ

If You program in Fortran, see in addition
HELP FORTRAN /IEEE_MODEand
HELP FORTRAN INTRINSIC ERRSNS
http://www.mpp.mpg.de/~huber
Dennis Handly
Acclaimed Contributor

Re: NANQ

What's wrong with your Quiet NaN? You can check for those at convenient points.
Or if you have IEEE, you can check the flags there.

>Steven: Many programming languages offer an "if" statement, which can be used to check for
valid data before performing any calculation

IEEE FP operations defines all inputs with valid outputs that can be checked later.
Jansen_8
Regular Advisor

Re: NANQ

Especially, in the development stage it is one of the very handy things of OpenVMS that you can set the program to stop and give full trace-back when something weird occurs (i.e. divide by zero, write/read outside the array boundaries etc...).

On my Alpha's I normally run in VAX-float mode and use the /check=all on the compiler line.
This forces all the run time errors to be flagged and the program to stop and write a trace-back.

You can also use the /check qualifier to test only for the i.e. divide by zero. See the user manual of the compiler, for the possible options.

Jouk