Ruby 1.9.2p136(2010-12-25revision30365)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

# missing/signbit.c

Go to the documentation of this file.

    00001 #include <limits.h>
    00002 #include "ruby.h"
    00003
    00004 int
    00005 signbit(double x)
    00006 {
    00007     enum {double_per_long = sizeof(double) / sizeof(long)};
    00008     enum {long_msb = sizeof(long) * CHAR_BIT - 1};
    00009     union {double d; unsigned long i[double_per_long];} u;
    00010     unsigned long l;
    00011
    00012     u.d = x;
    00013 #ifdef WORDS_BIGENDIAN
    00014     l = u.i[0];
    00015 #else
    00016     l = u.i[double_per_long - 1];
    00017 #endif
    00018     return (int)(l >> long_msb);
    00019 }
    00020