average true range

J

Joachim Schmitz

Bill said:
[snip]

assert(0);
return sqrt(-1.);
}

What's the sqrt function called for ? And the 0 passed to assert?
The assert(0) will printa a diagnostic and in debug mode abort the program,
the sqrt(-1.) will cause a domain error to happen (errno being set to EDOM)
in production mode (i.e. which NDEBUG being #define-ed)

Bye, Jojo
 
U

user923005

Bill said:

   assert(0);
   return sqrt(-1.);
}
 What's the sqrt function called for ? And the 0 passed to assert?

The assert(0) will printa a diagnostic and in debug mode abort the program,
the sqrt(-1.) will cause a domain error to happen (errno being set to EDOM)
in production mode (i.e. which NDEBUG being #define-ed)

To the O.P.:
The purpose of those modifications was to demonstrate a bug in your
program when equal inputs were entered.
E.g., try your original code with 20,20,20 and it does not perform a
correct computation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top