123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- /* ieeeck.f -- translated by f2c (version 20061008).
- You must link the resulting object file with libf2c:
- on Microsoft Windows system, link with libf2c.lib;
- on Linux or Unix systems, link with .../path/to/libf2c.a -lm
- or, if you install libf2c.a in a standard place, with -lf2c -lm
- -- in that order, at the end of the command line, as in
- cc *.o -lf2c -lm
- Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
- http://www.netlib.org/f2c/libf2c.zip
- */
- #include "f2c.h"
- #include "blaswrap.h"
- integer _starpu_ieeeck_(integer *ispec, real *zero, real *one)
- {
- /* System generated locals */
- integer ret_val;
- /* Local variables */
- real nan1, nan2, nan3, nan4, nan5, nan6, neginf, posinf, negzro, newzro;
- /* -- LAPACK auxiliary routine (version 3.2) -- */
- /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
- /* November 2006 */
- /* .. Scalar Arguments .. */
- /* .. */
- /* Purpose */
- /* ======= */
- /* IEEECK is called from the ILAENV to verify that Infinity and */
- /* possibly NaN arithmetic is safe (i.e. will not trap). */
- /* Arguments */
- /* ========= */
- /* ISPEC (input) INTEGER */
- /* Specifies whether to test just for inifinity arithmetic */
- /* or whether to test for infinity and NaN arithmetic. */
- /* = 0: Verify infinity arithmetic only. */
- /* = 1: Verify infinity and NaN arithmetic. */
- /* ZERO (input) REAL */
- /* Must contain the value 0.0 */
- /* This is passed to prevent the compiler from optimizing */
- /* away this code. */
- /* ONE (input) REAL */
- /* Must contain the value 1.0 */
- /* This is passed to prevent the compiler from optimizing */
- /* away this code. */
- /* RETURN VALUE: INTEGER */
- /* = 0: Arithmetic failed to produce the correct answers */
- /* = 1: Arithmetic produced the correct answers */
- /* .. Local Scalars .. */
- /* .. */
- /* .. Executable Statements .. */
- ret_val = 1;
- posinf = *one / *zero;
- if (posinf <= *one) {
- ret_val = 0;
- return ret_val;
- }
- neginf = -(*one) / *zero;
- if (neginf >= *zero) {
- ret_val = 0;
- return ret_val;
- }
- negzro = *one / (neginf + *one);
- if (negzro != *zero) {
- ret_val = 0;
- return ret_val;
- }
- neginf = *one / negzro;
- if (neginf >= *zero) {
- ret_val = 0;
- return ret_val;
- }
- newzro = negzro + *zero;
- if (newzro != *zero) {
- ret_val = 0;
- return ret_val;
- }
- posinf = *one / newzro;
- if (posinf <= *one) {
- ret_val = 0;
- return ret_val;
- }
- neginf *= posinf;
- if (neginf >= *zero) {
- ret_val = 0;
- return ret_val;
- }
- posinf *= posinf;
- if (posinf <= *one) {
- ret_val = 0;
- return ret_val;
- }
- /* Return if we were only asked to check infinity arithmetic */
- if (*ispec == 0) {
- return ret_val;
- }
- nan1 = posinf + neginf;
- nan2 = posinf / neginf;
- nan3 = posinf / posinf;
- nan4 = posinf * *zero;
- nan5 = neginf * negzro;
- nan6 = nan5 * 0.f;
- if (nan1 == nan1) {
- ret_val = 0;
- return ret_val;
- }
- if (nan2 == nan2) {
- ret_val = 0;
- return ret_val;
- }
- if (nan3 == nan3) {
- ret_val = 0;
- return ret_val;
- }
- if (nan4 == nan4) {
- ret_val = 0;
- return ret_val;
- }
- if (nan5 == nan5) {
- ret_val = 0;
- return ret_val;
- }
- if (nan6 == nan6) {
- ret_val = 0;
- return ret_val;
- }
- return ret_val;
- } /* _starpu_ieeeck_ */
|