Subversion Repositories Kolibri OS

Rev

Rev 1906 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3362 Serge 1
/* Copyright (C) 2002, 2007 by  Red Hat, Incorporated. All rights reserved.
2
 *
3
 * Permission to use, copy, modify, and distribute this software
4
 * is freely granted, provided that this notice is preserved.
5
 */
6
 
7
#include "fdlibm.h"
8
 
9
int
10
__fpclassifyd (double x)
11
{
12
  __uint32_t msw, lsw;
13
 
14
  EXTRACT_WORDS(msw,lsw,x);
15
 
16
  if ((msw == 0x00000000 && lsw == 0x00000000) ||
17
      (msw == 0x80000000 && lsw == 0x00000000))
18
    return FP_ZERO;
19
  else if ((msw >= 0x00100000 && msw <= 0x7fefffff) ||
20
           (msw >= 0x80100000 && msw <= 0xffefffff))
21
    return FP_NORMAL;
22
  else if ((msw >= 0x00000000 && msw <= 0x000fffff) ||
23
           (msw >= 0x80000000 && msw <= 0x800fffff))
24
    /* zero is already handled above */
25
    return FP_SUBNORMAL;
26
  else if ((msw == 0x7ff00000 && lsw == 0x00000000) ||
27
           (msw == 0xfff00000 && lsw == 0x00000000))
28
    return FP_INFINITE;
29
  else
30
    return FP_NAN;
31
}