Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGReal16.cpp File Reference

#include <assert.h>
#include <OSGBaseTypes.h>
#include <OSGReal16.h>

Go to the source code of this file.

Namespaces

namespace  osg
namespace  std

Functions

void testNormalized (float f)
void testDenormalized (float f)
ostream & operator<< (ostream &os, Real16 h)
istream & operator>> (istream &is, Real16 &h)
void printBits (ostream &os, Real16 h)

Variables

static Char8 cvsid_cpp [] = "@(#)$Id: $"
static Char8 cvsid_hpp [] = OSGREAL16_HEADER_CVSID


Function Documentation

void @0::testNormalized float  f  )  [static]
 

Definition at line 16691 of file OSGReal16.cpp.

References REAL16_EPSILON.

Referenced by osg::Real16::selftest().

16692     {
16693     Real16  h (f);
16694     float e (1 - h / f);
16695 
16696     if (e < 0)
16697         e = -e;
16698 
16699     if (e > REAL16_EPSILON * 0.5)
16700     {
16701         cerr << "Internal error: float/half conversion does not work.";
16702         assert (false);
16703     }
16704     }

void @0::testDenormalized float  f  )  [static]
 

Definition at line 16708 of file OSGReal16.cpp.

References REAL16_MIN.

Referenced by osg::Real16::selftest().

16709     {
16710     Real16  h (f);
16711     float e (h - f);
16712 
16713     if (e < 0)
16714         e = -e;
16715 
16716     if (e > REAL16_MIN * 0.5)
16717     {
16718         cerr << "Internal error: float/half conversion does not work.";
16719         assert (false);
16720     }
16721     }

ostream& operator<< ostream &  os,
Real16  h
 

Definition at line 16758 of file OSGReal16.cpp.

16759 {
16760     os << float (h);
16761     return os;
16762 }

istream& operator>> istream &  is,
Real16 h
 

Definition at line 16766 of file OSGReal16.cpp.

16767 {
16768     float f;
16769     is >> f;
16770     h = Real16 (f);
16771     return is;
16772 }

void printBits ostream &  os,
Real16  h
 

Definition at line 16781 of file OSGReal16.cpp.

References osg::Real16::bits().

16782 {
16783     unsigned short b = h.bits();
16784 
16785     for (int i = 15; i >= 0; i--)
16786     {
16787     os << (((b >> i) & 1)? '1': '0');
16788 
16789     if (i == 15 || i == 10)
16790         os << ' ';
16791     }
16792 }


Variable Documentation

Char8 cvsid_cpp[] = "@(#)$Id: $" [static]
 

Definition at line 16858 of file OSGReal16.cpp.

Char8 cvsid_hpp[] = OSGREAL16_HEADER_CVSID [static]
 

Definition at line 16859 of file OSGReal16.cpp.


Generated on Thu Aug 25 04:12:22 2005 for OpenSG by  doxygen 1.4.3