| 102 | } |
| 103 | |
| 104 | static double py_hypot(double a, double b) { |
| 105 | double x0 = fabs(a); |
| 106 | double x1 = fabs(b); |
| 107 | double max = 0.0; |
| 108 | bool nan = false; |
| 109 | if (isnan(x0)) { |
| 110 | nan = true; |
| 111 | } else if (x0 > max) { |
| 112 | max = x0; |
| 113 | } |
| 114 | if (isnan(x1)) { |
| 115 | nan = true; |
| 116 | } else if (x1 > max) { |
| 117 | max = x1; |
| 118 | } |
| 119 | if (isinf(max)) { |
| 120 | return max; |
| 121 | } |
| 122 | if (nan) { |
| 123 | return NAN; |
| 124 | } |
| 125 | if (max == 0.0) { |
| 126 | return max; |
| 127 | } |
| 128 | return vec_norm2(x0, x1, max); |
| 129 | } |
| 130 | |
| 131 | /* ── Page text ───────────────────────────────────────────────────── */ |
| 132 |