File: get_double_format

package info (click to toggle)
pari 2.17.3-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 24,508 kB
  • sloc: ansic: 281,184; sh: 861; perl: 420; yacc: 214; makefile: 162; f90: 88
file content (51 lines) | stat: -rw-r--r-- 1,605 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
exe=$osname-$arch-endian$$$exe_suff
cmd="$CC $CFLAGS $extraflag endian.c -o $exe"; . log_cmd
if test -r $exe; then
  doubleformat=`$RUNTEST $exe`;
else
  echo "***************************************************************"
  echo "Cannot compile endian.c. Aborting. PLEASE REPORT!"
  exit 1
fi
. cleanup_exe
case "$doubleformat" in
  *IEEE*)
    echo "***************************************************************"
    echo "Your 'double' type does not follow the IEEE754 format. Aborting"
    echo "PLEASE REPORT! (dbltor/rtodbl need to be fixed)"; exit 1;;
  -) sizeof_long=8;;
  *) sizeof_long=4;;
esac
echo "Given the previous choices, sizeof(long) is $sizeof_long chars."

if test "$fastread" != yes; then
cat << EOT
If your hardware supports different size of longs (e.g SGI/MIPS), and you
want to use a different word size than the above. You should probably have
specified some exotic compilation flag CFLAG (e.g -o32,-n32).

EOT

  if test $doubleformat != "-"; then
cat << EOT
For 32-bit architecture, PARI needs to know the format of your 'double' type.
PARI assumes doubles are stored in IEEE754 format [ (sign, exponent, mantissa
high) on one word, (mantissa low) on another ]; assuming a
  union { double d; ulong l[2]; } x;
are the double exponent and sign stored on x.i[0] (0) or on x.i[1] (1) ?

Using \$CC \$CFLAGS with
  CC    =$CC
  CFLAGS=$CFLAGS
the answer is: $doubleformat.
EOT
  fi
fi
case $doubleformat in
  0) _format='l[0], l[1]';;
  1) _format='l[1], l[0]';;
  -) _format='not needed (64bit)';;
esac
cat <<EOT
The internal word representation of a double is $_format.
EOT