IS_NUMBER_NAN | IS_NUMBER_NEG
0
-possibly with IS_NUMBER_TRAILING.
+possibly |-ed with IS_NUMBER_TRAILING.
-If an infinity or not-a-number is recognized, the *sp will point to
-one past the end of the recognized string. If the recognition fails,
+If an infinity or a not-a-number is recognized, the *sp will point to
+one byte past the end of the recognized string. If the recognition fails,
zero is returned, and the *sp will not move.
=cut
{
const char* s = *sp;
int flags = 0;
- bool odh = FALSE; /* one dot hash: 1.#INF */
+ bool odh = FALSE; /* one-dot-hash: 1.#INF */
PERL_ARGS_ASSERT_GROK_INFNAN;
}
if (*s == '1') {
- /* Visual C: 1.#SNAN, -1.#QNAN, 1#INF, 1#.IND (maybe also 1.#NAN) */
+ /* Visual C: 1.#SNAN, -1.#QNAN, 1#INF, 1.#IND (maybe also 1.#NAN)
+ * Let's keep the dot optional. */
s++; if (s == send) return 0;
if (*s == '.') {
s++; if (s == send) return 0;
}
if (isALPHA_FOLD_EQ(*s, 'I')) {
- /* INF or IND (1.#IND is indeterminate, a certain type of NAN) */
+ /* INF or IND (1.#IND is "indeterminate", a certain type of NAN) */
+
s++; if (s == send || isALPHA_FOLD_NE(*s, 'N')) return 0;
s++; if (s == send) return 0;
if (isALPHA_FOLD_EQ(*s, 'F')) {
return 0;
}
else {
- /* NAN */
+ /* Maybe NAN of some sort */
+
if (isALPHA_FOLD_EQ(*s, 'S') || isALPHA_FOLD_EQ(*s, 'Q')) {
/* snan, qNaN */
/* XXX do something with the snan/qnan difference */