~ubuntu-branches/ubuntu/karmic/grace/karmic

« back to all changes in this revision

Viewing changes to cephes/check_float.c

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-19 14:19:58 UTC
  • Revision ID: james.westby@ubuntu.com-20020319141958-5gxna6vo1ek3zjml
Tags: upstream-5.1.7
ImportĀ upstreamĀ versionĀ 5.1.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* check_float.c -- Rolf Niepraschk 11/97, niepraschk@ptb.de */
 
2
/* test program for the cephes library definitions */
 
3
 
 
4
#include <stdio.h>
 
5
#include <stdlib.h>
 
6
#include <string.h>
 
7
 
 
8
#define LOG2EA 0.44269504088896340735992
 
9
#define EQS(x, y) (strcmp(x, y) == 0)
 
10
#define ACCURACY "%1.4f"
 
11
 
 
12
typedef struct
 
13
{
 
14
  union {unsigned short s[5]; double d;} f;
 
15
  char *name;  
 
16
} XTYPE;
 
17
 
 
18
XTYPE X[] = { {{0037742,0124354,0122560,0057703}, "DEC"}, 
 
19
              {{0x0bf8,0x94ae,0x551d,0x3fdc}, "IBMPC"},
 
20
              {{0x3fdc,0x551d,0x94ae,0x0bf8}, "MIEEE"},
 
21
              {{0,0,0,0}, "UNK"},
 
22
              {{0,0,0,0}, ""} 
 
23
            };
 
24
            
 
25
int main (int argc, char *argv[])
 
26
{
 
27
  int i; char TMPSTR[1024]; char LOG2EA_STR[80];
 
28
  i = 0;
 
29
  
 
30
  sprintf(LOG2EA_STR, ACCURACY, LOG2EA);
 
31
  
 
32
  for (i=0; *X[i].name; i++) 
 
33
  {
 
34
    sprintf(TMPSTR, ACCURACY, X[i].f.d);
 
35
    if (EQS(TMPSTR, LOG2EA_STR)) break;
 
36
  }
 
37
    
 
38
  if (*X[i].name) 
 
39
     printf("Your system needs \"#define %s = 1\"\n", X[i].name);
 
40
  else
 
41
     printf("Try to use \"#define %s = 1\"\n", X[--i].name); 
 
42
  
 
43
  
 
44
  exit(EXIT_SUCCESS);
 
45
}