Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect assigning of values to "long double" type #138

Open
GoogleCodeExporter opened this issue May 5, 2016 · 5 comments
Open

incorrect assigning of values to "long double" type #138

GoogleCodeExporter opened this issue May 5, 2016 · 5 comments

Comments

@GoogleCodeExporter
Copy link

If we execute the program below on SX:

{{{

#include <stdlib.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
    long double ld;
    char* __sanity;
    ld = 1.0l;
    printf("ld = %llf\n", ld);
    return 0;
}

}}}

we get the "ld = 1.937500" printout which is incorrect. 

There seems to be some issues with assigning constant values to "long
double" variables.

As a consequence, a number of tests fail (e.g.
"22_locale/num_get/get/char/10.cc").

Original issue reported on code.google.com by [email protected] on 19 Jun 2009 at 1:53

@GoogleCodeExporter
Copy link
Author

Well, as it turns out, the source of the problem isn't in assigning the values 
to
"long double". The incorrect printout is there due to the disability of 
SuperUX's
"printf" function to print "long double" (on SuperUX, "long double" are 
represented
as 64-bit numbers).

Well, the "22_locale/num_get/get/char/10.cc" test case still fails due to the
incorrect handling of "long double" numbers. Wil have to search somewhere else 
for
the cause.

Original comment by [email protected] on 30 Jun 2009 at 12:04

@GoogleCodeExporter
Copy link
Author

Once again, I have correct myself... :)

The SuperUX's "printf" function does support the printout of "long double" 
values,
but not in the standard IEEE format for quad precision numbers, but in SX's 
format,
which is described in the "3.1.2 Floating-Point Data" section of the "SX-8 CPU
Functional Description Manual".

If we compile the program below with sx-gcc, it prints "SX IEEE QUAD PRECISON 
ld =
1.000000" if executed on SuperUx.

Original comment by [email protected] on 30 Jun 2009 at 12:59

@GoogleCodeExporter
Copy link
Author

Oh yeah, here is the proggie... :)

{{{

#include <stdlib.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
    long double ld;
    char* __sanity;
    long *pld = &ld;
    pld[0] = 0x3ff0000000000000;
    pld[1] = 0x3cb0000000000000; 

    printf("SX IEEE QUAD PRECISON ld = %Lf\n", ld);
    return 0;
}

}}}

Original comment by [email protected] on 30 Jun 2009 at 1:01

@GoogleCodeExporter
Copy link
Author

As expected, this issue is fixed if we switch from the "FLOAT_MODE (TF, 16,
ieee_quad_format);" representation of quad precision floating point values to
"FLOAT_MODE (TF, 16, sx_quad_format);" in the "gcc/config/sx/sx-modes.def" file.

However before actually commit this change to the repository, we will hav to 
perform
additional tests to make sure that we don't break something else.


Original comment by [email protected] on 30 Jun 2009 at 4:24

@GoogleCodeExporter
Copy link
Author

test and fix for release. check if quad insns are implemented properly.

Original comment by [email protected] on 9 Oct 2009 at 9:28

  • Added labels: Priority-Critical
  • Removed labels: Priority-Medium

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant