From help-request at octave dot org Fri Sep 23 12:52:23 2005 Subject: RE: lo_ieee_init: unrecognized floating point format! on ARM platform From: "John W. Eaton" To: Simon Pickering Cc: help-octave at bevo dot che dot wisc dot edu Date: Fri, 23 Sep 2005 13:51:43 -0400 On 23-Sep-2005, Simon Pickering wrote: | One final interesting fact - although the ARM processors can be either | little- or bigendian (well there are 4 modes actually), mine is running in | little-endian mode. That said, to make R compile correctly I had to specify | that it was big-endian and as you've said above - the output looks to be | big-endian too. I think I need to do some reading up on ARM in general and | look at how this affects the machar code, etc. You might also try applying the following patch to machar.c, then compiling with gcc -DDP -DTEST machar.c then run the resulting binary. Here is what I see (x86): $ ./a.out Double precision MACHAR constants ibeta = 2 it = 53 irnd = 5 ngrd = 0 machep = -52 negep = -53 iexp = 11 minexp = -1022 maxexp = 1024 eps 2.2204460492503131e-16 0 3CB00000 epsneg 1.1102230246251565e-16 0 3CA00000 xmin 2.2250738585072014e-308 0 100000 xmax 1.7976931348623157e+308 FFFFFFFF 7FEFFFFF If you have IEEE floating point, I'd expect the same numbers, but with the hex values swapped if the byte ordering is different from x86. jwe Index: machar.c =================================================================== RCS file: /cvs/octave/libcruft/misc/machar.c,v retrieving revision 1.7 diff -u -r1.7 machar.c --- machar.c 1 Mar 2005 18:01:54 -0000 1.7 +++ machar.c 23 Sep 2005 17:44:09 -0000 at @ -4,7 +4,9 @@ #include +#ifndef TEST #include "f77-fcn.h" +#endif /* at @ -364,6 +366,8 @@ } +#ifndef TEST + F77_RET_T F77_FUNC (machar, MACHAR) (REAL *xmin, REAL *xmax, REAL *epsneg, REAL *eps, REAL *log10_ibeta) at @ -390,3 +394,79 @@ F77_RETURN (0) } + +#else + + +/* + +This program prints hardware-determined double-precision machine +constants obtained from rmachar. Dmachar is a C translation of the +Fortran routine MACHAR from W. J. Cody, "MACHAR: A subroutine to +dynamically determine machine parameters". TOMS (14), 1988. + +Descriptions of the machine constants are given in the prologue +comments in rmachar. + +Subprograms called + + rmachar + +Original driver: Richard Bartels, October 16, 1985 + +Modified by: W. J. Cody + July 26, 1988 + +*/ +int +main (void) +{ + + int ibeta, iexp, irnd, it, machep, maxexp, minexp, negep, ngrd; + + int i; + + REAL eps, epsneg, xmax, xmin; + + union wjc + { + long int jj[REALSIZE]; + REAL xbig; + } uval; + + rmachar (&ibeta, &it, &irnd, &ngrd, &machep, &negep, &iexp, + &minexp, &maxexp, &eps, &epsneg, &xmin, &xmax); + + printf (PREC); + printf (" precision MACHAR constants\n"); + printf ("ibeta = %d\n", ibeta); + printf ("it = %d\n", it); + printf ("irnd = %d\n", irnd); + printf ("ngrd = %d\n", ngrd); + printf ("machep = %d\n", machep); + printf ("negep = %d\n", negep); + printf ("iexp = %d\n", iexp); + printf ("minexp = %d\n", minexp); + printf ("maxexp = %d\n", maxexp); + +#define DISPLAY(s, x) \ + do \ + { \ + uval.xbig = x ; \ + printf (s); \ + printf (" %24.16e ", (double) x) ; \ + for (i = 0; i < REALSIZE; i++) \ + printf (" %9X ", uval.jj[i]) ; \ + printf ("\n"); \ + } \ + while (0) + + DISPLAY ("eps ", eps); + DISPLAY ("epsneg", epsneg); + DISPLAY ("xmin ", xmin); + DISPLAY ("xmax ", xmax); + + return 0; +} + +#endif ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------