ieeeck.c
Go to the documentation of this file.
00001 /* ieeeck.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 integer ieeeck_(integer *ispec, real *zero, real *one)
00017 {
00018     /* System generated locals */
00019     integer ret_val;
00020 
00021     /* Local variables */
00022     real nan1, nan2, nan3, nan4, nan5, nan6, neginf, posinf, negzro, newzro;
00023 
00024 
00025 /*  -- LAPACK auxiliary routine (version 3.2) -- */
00026 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00027 /*     November 2006 */
00028 
00029 /*     .. Scalar Arguments .. */
00030 /*     .. */
00031 
00032 /*  Purpose */
00033 /*  ======= */
00034 
00035 /*  IEEECK is called from the ILAENV to verify that Infinity and */
00036 /*  possibly NaN arithmetic is safe (i.e. will not trap). */
00037 
00038 /*  Arguments */
00039 /*  ========= */
00040 
00041 /*  ISPEC   (input) INTEGER */
00042 /*          Specifies whether to test just for inifinity arithmetic */
00043 /*          or whether to test for infinity and NaN arithmetic. */
00044 /*          = 0: Verify infinity arithmetic only. */
00045 /*          = 1: Verify infinity and NaN arithmetic. */
00046 
00047 /*  ZERO    (input) REAL */
00048 /*          Must contain the value 0.0 */
00049 /*          This is passed to prevent the compiler from optimizing */
00050 /*          away this code. */
00051 
00052 /*  ONE     (input) REAL */
00053 /*          Must contain the value 1.0 */
00054 /*          This is passed to prevent the compiler from optimizing */
00055 /*          away this code. */
00056 
00057 /*  RETURN VALUE:  INTEGER */
00058 /*          = 0:  Arithmetic failed to produce the correct answers */
00059 /*          = 1:  Arithmetic produced the correct answers */
00060 
00061 /*     .. Local Scalars .. */
00062 /*     .. */
00063 /*     .. Executable Statements .. */
00064     ret_val = 1;
00065 
00066     posinf = *one / *zero;
00067     if (posinf <= *one) {
00068         ret_val = 0;
00069         return ret_val;
00070     }
00071 
00072     neginf = -(*one) / *zero;
00073     if (neginf >= *zero) {
00074         ret_val = 0;
00075         return ret_val;
00076     }
00077 
00078     negzro = *one / (neginf + *one);
00079     if (negzro != *zero) {
00080         ret_val = 0;
00081         return ret_val;
00082     }
00083 
00084     neginf = *one / negzro;
00085     if (neginf >= *zero) {
00086         ret_val = 0;
00087         return ret_val;
00088     }
00089 
00090     newzro = negzro + *zero;
00091     if (newzro != *zero) {
00092         ret_val = 0;
00093         return ret_val;
00094     }
00095 
00096     posinf = *one / newzro;
00097     if (posinf <= *one) {
00098         ret_val = 0;
00099         return ret_val;
00100     }
00101 
00102     neginf *= posinf;
00103     if (neginf >= *zero) {
00104         ret_val = 0;
00105         return ret_val;
00106     }
00107 
00108     posinf *= posinf;
00109     if (posinf <= *one) {
00110         ret_val = 0;
00111         return ret_val;
00112     }
00113 
00114 
00115 
00116 
00117 /*     Return if we were only asked to check infinity arithmetic */
00118 
00119     if (*ispec == 0) {
00120         return ret_val;
00121     }
00122 
00123     nan1 = posinf + neginf;
00124 
00125     nan2 = posinf / neginf;
00126 
00127     nan3 = posinf / posinf;
00128 
00129     nan4 = posinf * *zero;
00130 
00131     nan5 = neginf * negzro;
00132 
00133     nan6 = nan5 * 0.f;
00134 
00135     if (nan1 == nan1) {
00136         ret_val = 0;
00137         return ret_val;
00138     }
00139 
00140     if (nan2 == nan2) {
00141         ret_val = 0;
00142         return ret_val;
00143     }
00144 
00145     if (nan3 == nan3) {
00146         ret_val = 0;
00147         return ret_val;
00148     }
00149 
00150     if (nan4 == nan4) {
00151         ret_val = 0;
00152         return ret_val;
00153     }
00154 
00155     if (nan5 == nan5) {
00156         ret_val = 0;
00157         return ret_val;
00158     }
00159 
00160     if (nan6 == nan6) {
00161         ret_val = 0;
00162         return ret_val;
00163     }
00164 
00165     return ret_val;
00166 } /* ieeeck_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:50