GNOME Bugzilla – Bug 141939
Incorrect floating point format for arm
Last modified: 2018-05-24 10:31:56 UTC
M_PI from various machines: sparc> ./a.out 40 09 21 fb 54 44 2d 18 x86> ./a.out 18 2d 44 54 fb 21 09 40 arm> ./a.out fb 21 09 40 18 2d 44 54 I don't know what endianness is reported for arm, but it is either little or big endian and thus wrong for floating point. See http://lists.gnome.org/archives/gnumeric-list/2004-May/msg00002.html and follow-ups.
Note especially that http://lists.gnome.org/archives/gnumeric-list/2004-May/msg00005.html claims they want to change format! In other words, configure needs to determine this based on a test program, not on cpp symbols.
The correct test for 'ARM devices using mixed-endian floating point' is: #if defined(__arm__) && !defined(__vfp__) && (G_BYTE_ORDER == G_LITTLE_ENDIAN) so it will still work on BIG_ENDIAN arm setups and newer hardware using the vector floating point hardware. This patches fixes reading in simple integers in a sheet: --- gsf-utils.c.~1.20.~ Tue Apr 27 08:03:21 2004 +++ gsf-utils.c Wed May 5 13:17:25 2004 @@ -200,7 +200,12 @@ double gsf_le_get_double (void const *p) { -#if G_BYTE_ORDER == G_BIG_ENDIAN +#if defined(__arm__) && !defined(__vfp__) && (G_BYTE_ORDER == G_LITTLE_ENDIAN) + double data; + memcpy ((char *)&data + 4, p, 4); + memcpy ((char *)&data, (const char *)p + 4, 4); + return data; +#elif G_BYTE_ORDER == G_BIG_ENDIAN if (sizeof (double) == 8) { double d; int i;
Fixed in cvs (for get and set) (by Morten Welinder) see: http://mail.gnome.org/archives/cvs-commits-list/2004-May/msg03303.html
This has been worked around in libgsf, not really fixed. This bug was filed for glib and detect-the-right-endianess problem remains here.
This bug does still exists?
> This bug does still exists? Of course it does! Hardware isn't likely to change. configure.ac thinks there are only two choices: G_BIG_ENDIAN and G_LITTLE_ENDIAN. You really can't handle more than two endian choices that way. (Re-fixing title -- there's no relevant patch here.)
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/21.