~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to routines/calelm/finite.c

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "../machine.h"
 
2
 
 
3
#if !(defined HAVE_FINITE) || (defined __MINGW32__) || (defined __ABSC__) 
 
4
 
 
5
typedef unsigned int __uint32_t;
 
6
typedef union 
 
7
{
 
8
  struct 
 
9
  {
 
10
    __uint32_t lsw;
 
11
    __uint32_t msw;
 
12
  } parts;
 
13
  double value;
 
14
} ieee_double_shape_type;
 
15
 
 
16
#ifdef __STDC__
 
17
int finite(double x)
 
18
#else
 
19
int finite(x)
 
20
double x;
 
21
#endif
 
22
{
 
23
  int hx;
 
24
  ieee_double_shape_type gh_u;
 
25
  
 
26
  gh_u.value = x;
 
27
  hx = gh_u.parts.msw;
 
28
  return  (int)((__uint32_t)((hx&0x7fffffff)-0x7ff00000)>>31);
 
29
}
 
30
 
 
31
#endif