aboutsummaryrefslogtreecommitdiff
path: root/gas/atof-generic.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2021-08-11 08:36:28 +0200
committerJan Beulich <jbeulich@suse.com>2021-08-11 08:36:28 +0200
commitf0dec3f488c12352f62aa8c3ef3adc22599cb1cb (patch)
tree63ce5887d3fa34662c04a7ce7dc5e475b4e0c36a /gas/atof-generic.c
parent7727283e512e9ff0b014092a483560afbf7dddfe (diff)
downloadgdb-f0dec3f488c12352f62aa8c3ef3adc22599cb1cb.zip
gdb-f0dec3f488c12352f62aa8c3ef3adc22599cb1cb.tar.gz
gdb-f0dec3f488c12352f62aa8c3ef3adc22599cb1cb.tar.bz2
gas: support NaN flavors
Like for infinity, there isn't just a single NaN. The sign bit may be of interest and, going beyond infinity, whether the value is quiet or signalling may be even more relevant to be able to encode. Note that an anomaly with x86'es double extended precision NaN values gets taken care of at the same time: For all other formats a positive value with all mantissa bits set was used, while here a negative value with all non-significant mantissa bits clear was chose for an unknown reason. For m68k, since I don't know their X_PRECISION floating point value layout, a warning gets issued if any of the new flavors was attempted to be encoded that way. However likely it may be that, given that the code lives in a source file supposedly implementing IEEE-compliant formats, the bit patterns of the individual words match x86'es, I didn't want to guess so. And my very, very old paper doc doesn't even mention floating point formats other than single and double.
Diffstat (limited to 'gas/atof-generic.c')
-rw-r--r--gas/atof-generic.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/gas/atof-generic.c b/gas/atof-generic.c
index 91d8aba..e933534 100644
--- a/gas/atof-generic.c
+++ b/gas/atof-generic.c
@@ -113,11 +113,29 @@ atof_generic (/* return pointer to just AFTER number we read. */
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;