root / src / lapack / util / ieeeck.f @ 3
Historique | Voir | Annoter | Télécharger (3,11 ko)
| 1 | 1 | pfleura2 | INTEGER FUNCTION IEEECK( ISPEC, ZERO, ONE ) |
|---|---|---|---|
| 2 | 1 | pfleura2 | * |
| 3 | 1 | pfleura2 | * -- LAPACK auxiliary routine (version 3.2) -- |
| 4 | 1 | pfleura2 | * -- LAPACK is a software package provided by Univ. of Tennessee, -- |
| 5 | 1 | pfleura2 | * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- |
| 6 | 1 | pfleura2 | * November 2006 |
| 7 | 1 | pfleura2 | * |
| 8 | 1 | pfleura2 | * .. Scalar Arguments .. |
| 9 | 1 | pfleura2 | INTEGER ISPEC |
| 10 | 1 | pfleura2 | REAL ONE, ZERO |
| 11 | 1 | pfleura2 | * .. |
| 12 | 1 | pfleura2 | * |
| 13 | 1 | pfleura2 | * Purpose |
| 14 | 1 | pfleura2 | * ======= |
| 15 | 1 | pfleura2 | * |
| 16 | 1 | pfleura2 | * IEEECK is called from the ILAENV to verify that Infinity and |
| 17 | 1 | pfleura2 | * possibly NaN arithmetic is safe (i.e. will not trap). |
| 18 | 1 | pfleura2 | * |
| 19 | 1 | pfleura2 | * Arguments |
| 20 | 1 | pfleura2 | * ========= |
| 21 | 1 | pfleura2 | * |
| 22 | 1 | pfleura2 | * ISPEC (input) INTEGER |
| 23 | 1 | pfleura2 | * Specifies whether to test just for inifinity arithmetic |
| 24 | 1 | pfleura2 | * or whether to test for infinity and NaN arithmetic. |
| 25 | 1 | pfleura2 | * = 0: Verify infinity arithmetic only. |
| 26 | 1 | pfleura2 | * = 1: Verify infinity and NaN arithmetic. |
| 27 | 1 | pfleura2 | * |
| 28 | 1 | pfleura2 | * ZERO (input) REAL |
| 29 | 1 | pfleura2 | * Must contain the value 0.0 |
| 30 | 1 | pfleura2 | * This is passed to prevent the compiler from optimizing |
| 31 | 1 | pfleura2 | * away this code. |
| 32 | 1 | pfleura2 | * |
| 33 | 1 | pfleura2 | * ONE (input) REAL |
| 34 | 1 | pfleura2 | * Must contain the value 1.0 |
| 35 | 1 | pfleura2 | * This is passed to prevent the compiler from optimizing |
| 36 | 1 | pfleura2 | * away this code. |
| 37 | 1 | pfleura2 | * |
| 38 | 1 | pfleura2 | * RETURN VALUE: INTEGER |
| 39 | 1 | pfleura2 | * = 0: Arithmetic failed to produce the correct answers |
| 40 | 1 | pfleura2 | * = 1: Arithmetic produced the correct answers |
| 41 | 1 | pfleura2 | * |
| 42 | 1 | pfleura2 | * .. Local Scalars .. |
| 43 | 1 | pfleura2 | REAL NAN1, NAN2, NAN3, NAN4, NAN5, NAN6, NEGINF, |
| 44 | 1 | pfleura2 | $ NEGZRO, NEWZRO, POSINF |
| 45 | 1 | pfleura2 | * .. |
| 46 | 1 | pfleura2 | * .. Executable Statements .. |
| 47 | 1 | pfleura2 | IEEECK = 1 |
| 48 | 1 | pfleura2 | * |
| 49 | 1 | pfleura2 | POSINF = ONE / ZERO |
| 50 | 1 | pfleura2 | IF( POSINF.LE.ONE ) THEN |
| 51 | 1 | pfleura2 | IEEECK = 0 |
| 52 | 1 | pfleura2 | RETURN |
| 53 | 1 | pfleura2 | END IF |
| 54 | 1 | pfleura2 | * |
| 55 | 1 | pfleura2 | NEGINF = -ONE / ZERO |
| 56 | 1 | pfleura2 | IF( NEGINF.GE.ZERO ) THEN |
| 57 | 1 | pfleura2 | IEEECK = 0 |
| 58 | 1 | pfleura2 | RETURN |
| 59 | 1 | pfleura2 | END IF |
| 60 | 1 | pfleura2 | * |
| 61 | 1 | pfleura2 | NEGZRO = ONE / ( NEGINF+ONE ) |
| 62 | 1 | pfleura2 | IF( NEGZRO.NE.ZERO ) THEN |
| 63 | 1 | pfleura2 | IEEECK = 0 |
| 64 | 1 | pfleura2 | RETURN |
| 65 | 1 | pfleura2 | END IF |
| 66 | 1 | pfleura2 | * |
| 67 | 1 | pfleura2 | NEGINF = ONE / NEGZRO |
| 68 | 1 | pfleura2 | IF( NEGINF.GE.ZERO ) THEN |
| 69 | 1 | pfleura2 | IEEECK = 0 |
| 70 | 1 | pfleura2 | RETURN |
| 71 | 1 | pfleura2 | END IF |
| 72 | 1 | pfleura2 | * |
| 73 | 1 | pfleura2 | NEWZRO = NEGZRO + ZERO |
| 74 | 1 | pfleura2 | IF( NEWZRO.NE.ZERO ) THEN |
| 75 | 1 | pfleura2 | IEEECK = 0 |
| 76 | 1 | pfleura2 | RETURN |
| 77 | 1 | pfleura2 | END IF |
| 78 | 1 | pfleura2 | * |
| 79 | 1 | pfleura2 | POSINF = ONE / NEWZRO |
| 80 | 1 | pfleura2 | IF( POSINF.LE.ONE ) THEN |
| 81 | 1 | pfleura2 | IEEECK = 0 |
| 82 | 1 | pfleura2 | RETURN |
| 83 | 1 | pfleura2 | END IF |
| 84 | 1 | pfleura2 | * |
| 85 | 1 | pfleura2 | NEGINF = NEGINF*POSINF |
| 86 | 1 | pfleura2 | IF( NEGINF.GE.ZERO ) THEN |
| 87 | 1 | pfleura2 | IEEECK = 0 |
| 88 | 1 | pfleura2 | RETURN |
| 89 | 1 | pfleura2 | END IF |
| 90 | 1 | pfleura2 | * |
| 91 | 1 | pfleura2 | POSINF = POSINF*POSINF |
| 92 | 1 | pfleura2 | IF( POSINF.LE.ONE ) THEN |
| 93 | 1 | pfleura2 | IEEECK = 0 |
| 94 | 1 | pfleura2 | RETURN |
| 95 | 1 | pfleura2 | END IF |
| 96 | 1 | pfleura2 | * |
| 97 | 1 | pfleura2 | * |
| 98 | 1 | pfleura2 | * |
| 99 | 1 | pfleura2 | * |
| 100 | 1 | pfleura2 | * Return if we were only asked to check infinity arithmetic |
| 101 | 1 | pfleura2 | * |
| 102 | 1 | pfleura2 | IF( ISPEC.EQ.0 ) |
| 103 | 1 | pfleura2 | $ RETURN |
| 104 | 1 | pfleura2 | * |
| 105 | 1 | pfleura2 | NAN1 = POSINF + NEGINF |
| 106 | 1 | pfleura2 | * |
| 107 | 1 | pfleura2 | NAN2 = POSINF / NEGINF |
| 108 | 1 | pfleura2 | * |
| 109 | 1 | pfleura2 | NAN3 = POSINF / POSINF |
| 110 | 1 | pfleura2 | * |
| 111 | 1 | pfleura2 | NAN4 = POSINF*ZERO |
| 112 | 1 | pfleura2 | * |
| 113 | 1 | pfleura2 | NAN5 = NEGINF*NEGZRO |
| 114 | 1 | pfleura2 | * |
| 115 | 1 | pfleura2 | NAN6 = NAN5*0.0 |
| 116 | 1 | pfleura2 | * |
| 117 | 1 | pfleura2 | IF( NAN1.EQ.NAN1 ) THEN |
| 118 | 1 | pfleura2 | IEEECK = 0 |
| 119 | 1 | pfleura2 | RETURN |
| 120 | 1 | pfleura2 | END IF |
| 121 | 1 | pfleura2 | * |
| 122 | 1 | pfleura2 | IF( NAN2.EQ.NAN2 ) THEN |
| 123 | 1 | pfleura2 | IEEECK = 0 |
| 124 | 1 | pfleura2 | RETURN |
| 125 | 1 | pfleura2 | END IF |
| 126 | 1 | pfleura2 | * |
| 127 | 1 | pfleura2 | IF( NAN3.EQ.NAN3 ) THEN |
| 128 | 1 | pfleura2 | IEEECK = 0 |
| 129 | 1 | pfleura2 | RETURN |
| 130 | 1 | pfleura2 | END IF |
| 131 | 1 | pfleura2 | * |
| 132 | 1 | pfleura2 | IF( NAN4.EQ.NAN4 ) THEN |
| 133 | 1 | pfleura2 | IEEECK = 0 |
| 134 | 1 | pfleura2 | RETURN |
| 135 | 1 | pfleura2 | END IF |
| 136 | 1 | pfleura2 | * |
| 137 | 1 | pfleura2 | IF( NAN5.EQ.NAN5 ) THEN |
| 138 | 1 | pfleura2 | IEEECK = 0 |
| 139 | 1 | pfleura2 | RETURN |
| 140 | 1 | pfleura2 | END IF |
| 141 | 1 | pfleura2 | * |
| 142 | 1 | pfleura2 | IF( NAN6.EQ.NAN6 ) THEN |
| 143 | 1 | pfleura2 | IEEECK = 0 |
| 144 | 1 | pfleura2 | RETURN |
| 145 | 1 | pfleura2 | END IF |
| 146 | 1 | pfleura2 | * |
| 147 | 1 | pfleura2 | RETURN |
| 148 | 1 | pfleura2 | END |