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

« back to all changes in this revision

Viewing changes to routines/sun/isanan.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
/* Copyright INRIA/ENPC */
 
2
#include <stdio.h>
 
3
#include <math.h>
 
4
 
 
5
#include "../machine.h"
 
6
 
 
7
#ifdef WIN32 
 
8
#ifndef __CYGWIN32__
 
9
#define _ISANAN
 
10
#include <float.h>
 
11
#endif 
 
12
#endif 
 
13
 
 
14
 
 
15
/* testing Nan returns 1 if a Nan is found and 0 elsewhere */
 
16
/* should be changed to use a libm isnan function when possible */
 
17
 
 
18
integer C2F(isanan)(x)
 
19
     double *x ;
 
20
{
 
21
#ifdef _ISANAN
 
22
  return(_isnan(*x)== 1);
 
23
#else
 
24
  return((!( *x <= 1.0 )) && (!( *x >= 1.0 )));
 
25
#endif
 
26
}
 
27
 
 
28
 
 
29
 
 
30
#ifdef TESTALONE 
 
31
int main()
 
32
{
 
33
  double x=0.0,y=1/x,z;
 
34
  z= y-y;
 
35
  if ( C2F(isanan)(&z) == 1) 
 
36
    fprintf(stdout,"z is a Nan\n");
 
37
  if ( C2F(isanan)(&x) == 1) 
 
38
    fprintf(stdout,"x is a Nan\n");
 
39
  if ( C2F(isanan)(&y) == 1) 
 
40
    fprintf(stdout,"y is a Nan\n");
 
41
}
 
42
                        
 
43
#endif 
 
44