/* atof_generic.c - turn a string of digits into a Flonum
- Copyright (C) 1987-2019 Free Software Foundation, Inc.
+ Copyright (C) 1987-2021 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
#include "as.h"
#include "safe-ctype.h"
-#ifndef FALSE
-#define FALSE (0)
-#endif
-#ifndef TRUE
-#define TRUE (1)
-#endif
-
#ifdef TRACE
static void flonum_print (const FLONUM_TYPE *);
#endif
switch (first_digit[0])
{
+ case 's':
+ case 'S':
+ case 'q':
+ case 'Q':
+ if (!strncasecmp ("nan", first_digit + 1, 3))
+ {
+ address_of_generic_floating_point_number->sign =
+ digits_sign_char == '+' ? TOUPPER (first_digit[0])
+ : TOLOWER (first_digit[0]);
+ address_of_generic_floating_point_number->exponent = 0;
+ address_of_generic_floating_point_number->leader =
+ address_of_generic_floating_point_number->low;
+ *address_of_string_pointer = first_digit + 4;
+ return 0;
+ }
+ break;
+
case 'n':
case 'N':
if (!strncasecmp ("nan", first_digit, 3))
{
- address_of_generic_floating_point_number->sign = 0;
+ address_of_generic_floating_point_number->sign =
+ digits_sign_char == '+' ? 0 : 'q';
address_of_generic_floating_point_number->exponent = 0;
address_of_generic_floating_point_number->leader =
address_of_generic_floating_point_number->low;
if ( /* seen_significant_digit || */ c > '0')
{
- seen_significant_digit = TRUE;
+ seen_significant_digit = true;
}
}
else
/* Assert sign of the number we made is '+'. */
address_of_generic_floating_point_number->sign = digits_sign_char;
- if (temporary_binary_low)
- free (temporary_binary_low);
- if (power_binary_low)
- free (power_binary_low);
+ free (temporary_binary_low);
+ free (power_binary_low);
free (digits_binary_low);
}
return return_value;