OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libm/] [common/] [s_fpclassify.c] - Blame information for rev 617

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/* 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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.