クラス sc_dt::sc_fxval_fast

#include <sc_fxval.h>

すべてのメンバ一覧

Public メソッド

 sc_fxval_fast (sc_fxval_fast_observer *=0)
 sc_fxval_fast (int, sc_fxval_fast_observer *=0)
 sc_fxval_fast (unsigned int, sc_fxval_fast_observer *=0)
 sc_fxval_fast (long, sc_fxval_fast_observer *=0)
 sc_fxval_fast (unsigned long, sc_fxval_fast_observer *=0)
 sc_fxval_fast (double, sc_fxval_fast_observer *=0)
 sc_fxval_fast (const char *, sc_fxval_fast_observer *=0)
 sc_fxval_fast (const sc_fxval &, sc_fxval_fast_observer *=0)
 sc_fxval_fast (const sc_fxval_fast &, sc_fxval_fast_observer *=0)
 sc_fxval_fast (const sc_fxnum &, sc_fxval_fast_observer *=0)
 sc_fxval_fast (const sc_fxnum_fast &, sc_fxval_fast_observer *=0)
 sc_fxval_fast (int64, sc_fxval_fast_observer *=0)
 sc_fxval_fast (uint64, sc_fxval_fast_observer *=0)
 sc_fxval_fast (const sc_int_base &, sc_fxval_fast_observer *=0)
 sc_fxval_fast (const sc_uint_base &, sc_fxval_fast_observer *=0)
 sc_fxval_fast (const sc_signed &, sc_fxval_fast_observer *=0)
 sc_fxval_fast (const sc_unsigned &, sc_fxval_fast_observer *=0)
 ~sc_fxval_fast ()
double get_val () const
void set_val (double)
const sc_fxval_fast operator- () const
const sc_fxval_fastoperator+ () const
 DECL_BIN_OP_T (/, int64) DECL_BIN_OP_T(/
uint64 DECL_BIN_OP_T (/, const sc_int_base &) DECL_BIN_OP_T(/
uint64 const sc_uint_baseDECL_BIN_OP_T (/, const sc_signed &) friend const sc_fxval_fast operator<< (const sc_fxval_fast &
const sc_fxval_fast operator++ (int)
const sc_fxval_fast operator-- (int)
sc_fxval_fastoperator++ ()
sc_fxval_fastoperator-- ()
 operator double () const
short to_short () const
unsigned short to_ushort () const
int to_int () const
unsigned int to_uint () const
long to_long () const
unsigned long to_ulong () const
int64 to_int64 () const
uint64 to_uint64 () const
float to_float () const
double to_double () const
const std::string to_string () const
const std::string to_string (sc_numrep) const
const std::string to_string (sc_numrep, bool) const
const std::string to_string (sc_fmt) const
const std::string to_string (sc_numrep, sc_fmt) const
const std::string to_string (sc_numrep, bool, sc_fmt) const
const std::string to_dec () const
const std::string to_bin () const
const std::string to_oct () const
const std::string to_hex () const
bool is_neg () const
bool is_zero () const
bool is_nan () const
bool is_inf () const
bool is_normal () const
bool rounding_flag () const
void print (::std::ostream &=::std::cout) const
void scan (::std::istream &=::std::cin)
void dump (::std::ostream &=::std::cout) const
bool get_bit (int) const

Public 変数

uint64 const sc_uint_baseint

Protected メソッド

sc_fxval_fast_observerobserver () const
sc_fxval_fast_observerlock_observer () const
void unlock_observer (sc_fxval_fast_observer *) const

Static Protected メソッド

static double from_string (const char *)

Private 変数

double m_val
sc_fxval_fast_observerm_observer

フレンド

class sc_fxnum_fast
void neg (sc_fxval_fast &, const sc_fxval_fast &)
const sc_fxval_fast operator/ (const sc_fxval_fast &, const sc_fxval_fast &)
const sc_fxval_fast operator>> (const sc_fxval_fast &, int)
void lshift (sc_fxval_fast &, const sc_fxval_fast &, int)
void rshift (sc_fxval_fast &, const sc_fxval_fast &, int)


説明

sc_fxval.h431 行で定義されています。


コンストラクタとデストラクタ

sc_dt::sc_fxval_fast::sc_fxval_fast ( sc_fxval_fast_observer = 0  )  [explicit]

sc_dt::sc_fxval_fast::sc_fxval_fast ( int  ,
sc_fxval_fast_observer = 0 
)

sc_dt::sc_fxval_fast::sc_fxval_fast ( unsigned  int,
sc_fxval_fast_observer = 0 
)

sc_dt::sc_fxval_fast::sc_fxval_fast ( long  ,
sc_fxval_fast_observer = 0 
)

sc_dt::sc_fxval_fast::sc_fxval_fast ( unsigned  long,
sc_fxval_fast_observer = 0 
)

sc_dt::sc_fxval_fast::sc_fxval_fast ( double  ,
sc_fxval_fast_observer = 0 
)

sc_dt::sc_fxval_fast::sc_fxval_fast ( const char *  ,
sc_fxval_fast_observer = 0 
)

sc_dt::sc_fxval_fast::sc_fxval_fast ( const sc_fxval ,
sc_fxval_fast_observer = 0 
)

sc_dt::sc_fxval_fast::sc_fxval_fast ( const sc_fxval_fast a,
sc_fxval_fast_observer observer_ = 0 
) [inline]

sc_fxval.h1559 行で定義されています。

01561 : m_val( a.m_val ),
01562   m_observer( observer_ )
01563 {
01564     SC_FXVAL_FAST_OBSERVER_DEFAULT_
01565     SC_FXVAL_FAST_OBSERVER_READ_( a )
01566     SC_FXVAL_FAST_OBSERVER_CONSTRUCT_( *this )
01567     SC_FXVAL_FAST_OBSERVER_WRITE_( *this )
01568 }

sc_dt::sc_fxval_fast::sc_fxval_fast ( const sc_fxnum a,
sc_fxval_fast_observer observer_ = 0 
) [inline]

sc_fxnum.h4939 行で定義されています。

04941 : m_val( a.to_double() ),
04942   m_observer( observer_ )
04943 {
04944     SC_FXVAL_FAST_OBSERVER_DEFAULT_
04945     SC_FXVAL_FAST_OBSERVER_CONSTRUCT_( *this )
04946     SC_FXVAL_FAST_OBSERVER_WRITE_( *this )
04947 }

sc_dt::sc_fxval_fast::sc_fxval_fast ( const sc_fxnum_fast a,
sc_fxval_fast_observer observer_ = 0 
) [inline]

sc_fxnum.h4950 行で定義されています。

04952 : m_val( a.get_val() ),
04953   m_observer( observer_ )
04954 {
04955     SC_FXVAL_FAST_OBSERVER_DEFAULT_
04956     SC_FXVAL_FAST_OBSERVER_CONSTRUCT_( *this )
04957     SC_FXVAL_FAST_OBSERVER_WRITE_( *this )
04958 }

sc_dt::sc_fxval_fast::sc_fxval_fast ( int64  ,
sc_fxval_fast_observer = 0 
) [explicit]

sc_dt::sc_fxval_fast::sc_fxval_fast ( uint64  ,
sc_fxval_fast_observer = 0 
) [explicit]

sc_dt::sc_fxval_fast::sc_fxval_fast ( const sc_int_base ,
sc_fxval_fast_observer = 0 
) [explicit]

sc_dt::sc_fxval_fast::sc_fxval_fast ( const sc_uint_base ,
sc_fxval_fast_observer = 0 
) [explicit]

sc_dt::sc_fxval_fast::sc_fxval_fast ( const sc_signed ,
sc_fxval_fast_observer = 0 
) [explicit]

sc_dt::sc_fxval_fast::sc_fxval_fast ( const sc_unsigned ,
sc_fxval_fast_observer = 0 
) [explicit]

sc_dt::sc_fxval_fast::~sc_fxval_fast (  )  [inline]

sc_fxval.h1611 行で定義されています。

01612 {
01613     SC_FXVAL_FAST_OBSERVER_DESTRUCT_( *this )
01614 }


関数

sc_fxval_fast_observer* sc_dt::sc_fxval_fast::observer (  )  const [protected]

double sc_dt::sc_fxval_fast::get_val (  )  const [inline]

sc_fxval.h1620 行で定義されています。

01621 {
01622     SC_FXVAL_FAST_OBSERVER_READ_( *this )
01623     return m_val;
01624 }

void sc_dt::sc_fxval_fast::set_val ( double  val_  )  [inline]

sc_fxval.h1629 行で定義されています。

01630 {
01631     m_val = val_;
01632     SC_FXVAL_FAST_OBSERVER_WRITE_( *this )
01633 }

const sc_fxval_fast sc_dt::sc_fxval_fast::operator- (  )  const [inline]

sc_fxval.h1640 行で定義されています。

01641 {
01642     SC_FXVAL_FAST_OBSERVER_READ_( *this )
01643     return sc_fxval_fast( - m_val );
01644 }

const sc_fxval_fast & sc_dt::sc_fxval_fast::operator+ (  )  const [inline]

sc_fxval.h1648 行で定義されています。

01649 {
01650     // SC_FXVAL_FAST_OBSERVER_READ_( *this )
01651     return *this;
01652 }

sc_dt::sc_fxval_fast::DECL_BIN_OP_T ( ,
int64   
)

uint64 sc_dt::sc_fxval_fast::DECL_BIN_OP_T ( ,
const sc_int_base  
)

uint64 const sc_uint_base& sc_dt::sc_fxval_fast::DECL_BIN_OP_T ( ,
const sc_signed  
) const

const sc_fxval_fast sc_dt::sc_fxval_fast::operator++ ( int   )  [inline]

sc_fxval.h2041 行で定義されています。

02042 {
02043     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02044     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02045     double c = m_val;
02046     m_val = m_val + 1;
02047     SC_FXVAL_FAST_OBSERVER_WRITE_( *this )
02048     return sc_fxval_fast( c );
02049 }

const sc_fxval_fast sc_dt::sc_fxval_fast::operator-- ( int   )  [inline]

sc_fxval.h2053 行で定義されています。

02054 {
02055     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02056     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02057     double c = m_val;
02058     m_val = m_val - 1;
02059     SC_FXVAL_FAST_OBSERVER_WRITE_( *this )
02060     return sc_fxval_fast( c );
02061 }

sc_fxval_fast & sc_dt::sc_fxval_fast::operator++ (  )  [inline]

sc_fxval.h2065 行で定義されています。

02066 {
02067     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02068     m_val = m_val + 1;
02069     SC_FXVAL_FAST_OBSERVER_WRITE_( *this )
02070     return *this;
02071 }

sc_fxval_fast & sc_dt::sc_fxval_fast::operator-- (  )  [inline]

sc_fxval.h2075 行で定義されています。

02076 {
02077     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02078     m_val = m_val - 1;
02079     SC_FXVAL_FAST_OBSERVER_WRITE_( *this )
02080     return *this;
02081 }

sc_dt::sc_fxval_fast::operator double (  )  const [inline]

sc_fxval.h2087 行で定義されています。

02088 {
02089     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02090     return m_val;
02091 }

short sc_dt::sc_fxval_fast::to_short (  )  const [inline]

sc_fxval.h2098 行で定義されています。

02099 {
02100     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02101     return static_cast<short>( m_val );
02102 }

unsigned short sc_dt::sc_fxval_fast::to_ushort (  )  const [inline]

sc_fxval.h2106 行で定義されています。

02107 {
02108     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02109     return static_cast<unsigned short>( m_val );
02110 }

int sc_dt::sc_fxval_fast::to_int (  )  const [inline]

sc_fxval.h2122 行で定義されています。

02123 {
02124     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02125     return static_cast<int>( m_val );
02126 }

unsigned int sc_dt::sc_fxval_fast::to_uint (  )  const [inline]

sc_fxval.h2130 行で定義されています。

02131 {
02132     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02133     return static_cast<unsigned int>( m_val );
02134 }

long sc_dt::sc_fxval_fast::to_long (  )  const [inline]

sc_fxval.h2146 行で定義されています。

02147 {
02148     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02149     return static_cast<long>( m_val );
02150 }

unsigned long sc_dt::sc_fxval_fast::to_ulong (  )  const [inline]

sc_fxval.h2154 行で定義されています。

02155 {
02156     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02157     return static_cast<unsigned long>( m_val );
02158 }

int64 sc_dt::sc_fxval_fast::to_int64 (  )  const [inline]

sc_fxval.h2114 行で定義されています。

02115 {
02116     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02117     return static_cast<int64>( m_val );
02118 }

uint64 sc_dt::sc_fxval_fast::to_uint64 (  )  const [inline]

sc_fxval.h2138 行で定義されています。

02139 {
02140     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02141     return static_cast<uint64>( m_val );
02142 }

float sc_dt::sc_fxval_fast::to_float (  )  const [inline]

sc_fxval.h2162 行で定義されています。

02163 {
02164     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02165     return static_cast<float>( m_val );
02166 }

double sc_dt::sc_fxval_fast::to_double (  )  const [inline]

sc_fxval.h2170 行で定義されています。

02171 {
02172     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02173     return m_val;
02174 }

const std::string sc_dt::sc_fxval_fast::to_string (  )  const

sc_fxval.cpp507 行で定義されています。

00508 {
00509     return std::string( sc_dt::to_string( m_val, SC_DEC, -1, SC_E ) );
00510 }

const std::string sc_dt::sc_fxval_fast::to_string ( sc_numrep  numrep  )  const

sc_fxval.cpp513 行で定義されています。

00514 {
00515     return std::string( sc_dt::to_string( m_val, numrep, -1, SC_E ) );
00516 }

const std::string sc_dt::sc_fxval_fast::to_string ( sc_numrep  numrep,
bool  w_prefix 
) const

sc_fxval.cpp519 行で定義されています。

00520 {
00521     return std::string( sc_dt::to_string( m_val, numrep, (w_prefix ? 1 : 0),
00522                                         SC_E ) );
00523 }

const std::string sc_dt::sc_fxval_fast::to_string ( sc_fmt  fmt  )  const

sc_fxval.cpp526 行で定義されています。

00527 {
00528     return std::string( sc_dt::to_string( m_val, SC_DEC, -1, fmt ) );
00529 }

const std::string sc_dt::sc_fxval_fast::to_string ( sc_numrep  numrep,
sc_fmt  fmt 
) const

sc_fxval.cpp532 行で定義されています。

00533 {
00534     return std::string( sc_dt::to_string( m_val, numrep, -1, fmt ) );
00535 }

const std::string sc_dt::sc_fxval_fast::to_string ( sc_numrep  numrep,
bool  w_prefix,
sc_fmt  fmt 
) const

sc_fxval.cpp538 行で定義されています。

00539 {
00540     return std::string( sc_dt::to_string( m_val, numrep, (w_prefix ? 1 : 0),
00541                                         fmt ) );
00542 }

const std::string sc_dt::sc_fxval_fast::to_dec (  )  const

sc_fxval.cpp546 行で定義されています。

00547 {
00548     return std::string( sc_dt::to_string( m_val, SC_DEC, -1, SC_E ) );
00549 }

const std::string sc_dt::sc_fxval_fast::to_bin (  )  const

sc_fxval.cpp552 行で定義されています。

00553 {
00554     return std::string( sc_dt::to_string( m_val, SC_BIN, -1, SC_E ) );
00555 }

const std::string sc_dt::sc_fxval_fast::to_oct (  )  const

sc_fxval.cpp558 行で定義されています。

00559 {
00560     return std::string( sc_dt::to_string( m_val, SC_OCT, -1, SC_E ) );
00561 }

const std::string sc_dt::sc_fxval_fast::to_hex (  )  const

sc_fxval.cpp564 行で定義されています。

00565 {
00566     return std::string( sc_dt::to_string( m_val, SC_HEX, -1, SC_E ) );
00567 }

bool sc_dt::sc_fxval_fast::is_neg (  )  const [inline]

sc_fxval.h2181 行で定義されています。

02182 {
02183     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02184     scfx_ieee_double id( m_val );
02185     return ( id.negative() != 0 );
02186 }

bool sc_dt::sc_fxval_fast::is_zero (  )  const [inline]

sc_fxval.h2190 行で定義されています。

02191 {
02192     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02193     scfx_ieee_double id( m_val );
02194     return id.is_zero();
02195 }

bool sc_dt::sc_fxval_fast::is_nan (  )  const [inline]

sc_fxval.h2199 行で定義されています。

02200 {
02201     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02202     scfx_ieee_double id( m_val );
02203     return id.is_nan();
02204 }

bool sc_dt::sc_fxval_fast::is_inf (  )  const [inline]

sc_fxval.h2208 行で定義されています。

02209 {
02210     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02211     scfx_ieee_double id( m_val );
02212     return id.is_inf();
02213 }

bool sc_dt::sc_fxval_fast::is_normal (  )  const [inline]

sc_fxval.h2217 行で定義されています。

02218 {
02219     SC_FXVAL_FAST_OBSERVER_READ_( *this )
02220     scfx_ieee_double id( m_val );
02221     return ( id.is_normal() || id.is_subnormal() || id.is_zero() );
02222 }

bool sc_dt::sc_fxval_fast::rounding_flag (  )  const [inline]

sc_fxval.h2227 行で定義されています。

02228 {
02229     // does not apply to sc_fxval_fast; included for API compatibility
02230     return false;
02231 }

void sc_dt::sc_fxval_fast::print ( ::std::ostream &  os = ::std::cout  )  const

sc_fxval.cpp573 行で定義されています。

00574 {
00575     os << sc_dt::to_string( m_val, SC_DEC, -1, SC_E );
00576 }

void sc_dt::sc_fxval_fast::scan ( ::std::istream &  is = ::std::cin  ) 

sc_fxval.cpp579 行で定義されています。

00580 {
00581     std::string s;
00582     is >> s;
00583     *this = s.c_str();
00584 }

void sc_dt::sc_fxval_fast::dump ( ::std::ostream &  os = ::std::cout  )  const

sc_fxval.cpp587 行で定義されています。

00588 {
00589     os << "sc_fxval_fast" << ::std::endl;
00590     os << "(" << ::std::endl;
00591     os << "val = " << m_val << ::std::endl;
00592     // TO BE COMPLETED
00593     // os << "r_flag   = " << m_r_flag << ::std::endl;
00594     // os << "observer = ";
00595     // if( m_observer != 0 )
00596     //     m_observer->dump( os );
00597     // else
00598     //     os << "0" << ::std::endl;
00599     os << ")" << ::std::endl;
00600 }

bool sc_dt::sc_fxval_fast::get_bit ( int  i  )  const

sc_fxval.cpp605 行で定義されています。

00606 {
00607     scfx_ieee_double id( m_val );
00608     if( id.is_zero() || id.is_nan() || id.is_inf() )
00609         return false;
00610 
00611     // convert to two's complement
00612 
00613     unsigned int m0 = id.mantissa0();
00614     unsigned int m1 = id.mantissa1();
00615 
00616     if( id.is_normal() )
00617         m0 += 1U << 20;
00618 
00619     if( id.negative() != 0 )
00620     {
00621         m0 = ~ m0;
00622         m1 = ~ m1;
00623         unsigned int tmp = m1;
00624         m1 += 1U;
00625         if( m1 <= tmp )
00626             m0 += 1U;
00627     }
00628 
00629     // get the right bit
00630 
00631     int j = i - id.exponent();
00632     if( ( j += 20 ) >= 32 )
00633         return ( ( m0 & 1U << 31 ) != 0 );
00634     else if( j >= 0 )
00635         return ( ( m0 & 1U << j ) != 0 );
00636     else if( ( j += 32 ) >= 0 )
00637         return ( ( m1 & 1U << j ) != 0 );
00638     else
00639         return false;
00640 }

sc_fxval_fast_observer * sc_dt::sc_fxval_fast::lock_observer (  )  const [protected]

sc_fxval.cpp646 行で定義されています。

00647 {
00648     SC_ASSERT_( m_observer != 0, "lock observer failed" );
00649     sc_fxval_fast_observer* tmp = m_observer;
00650     m_observer = 0;
00651     return tmp;
00652 }

void sc_dt::sc_fxval_fast::unlock_observer ( sc_fxval_fast_observer observer_  )  const [protected]

sc_fxval.cpp655 行で定義されています。

00656 {
00657     SC_ASSERT_( observer_ != 0, "unlock observer failed" );
00658     m_observer = observer_;
00659 }

double sc_dt::sc_fxval_fast::from_string ( const char *  s  )  [static, protected]

sc_fxval.cpp669 行で定義されています。

00670 {
00671     SCFX_FAIL_IF_( s == 0 || *s == 0 );
00672 
00673     scfx_string s2;
00674     s2 += s;
00675     s2 += '\0';
00676 
00677     bool sign_char;
00678     int sign = scfx_parse_sign( s, sign_char );
00679 
00680     sc_numrep numrep = scfx_parse_prefix( s );
00681 
00682     int base = 0;
00683 
00684     switch( numrep )
00685     {
00686         case SC_DEC:
00687         {
00688             base = 10;
00689             if( scfx_is_nan( s ) )  // special case: NaN
00690                 return static_cast<double>( scfx_ieee_double::nan() );
00691             if( scfx_is_inf( s ) )  // special case: Infinity
00692                 return static_cast<double>( scfx_ieee_double::inf( sign ) );
00693             break;
00694         }
00695         case SC_BIN:
00696         case SC_BIN_US:
00697         {
00698             SCFX_FAIL_IF_( sign_char );
00699             base = 2;
00700             break;
00701         }
00702         
00703         case SC_BIN_SM:
00704         {
00705             base = 2;
00706             break;
00707         }
00708         case SC_OCT:
00709         case SC_OCT_US:
00710         {
00711             SCFX_FAIL_IF_( sign_char );
00712             base = 8;
00713             break;
00714         }
00715         case SC_OCT_SM:
00716         {
00717             base = 8;
00718             break;
00719         }
00720         case SC_HEX:
00721         case SC_HEX_US:
00722         {
00723             SCFX_FAIL_IF_( sign_char );
00724             base = 16;
00725             break;
00726         }
00727         case SC_HEX_SM:
00728         {
00729             base = 16;
00730             break;
00731         }
00732         case SC_CSD:
00733         {
00734             SCFX_FAIL_IF_( sign_char );
00735             base = 2;
00736             scfx_csd2tc( s2 );
00737             s = (const char*) s2 + 4;
00738             numrep = SC_BIN;
00739             break;
00740         }
00741        default:;// Martin, what is default???
00742     }
00743 
00744     //
00745     // find end of mantissa and count the digits and points
00746     //
00747 
00748     const char *end = s;
00749     bool based_point = false;
00750     int int_digits = 0;
00751     int frac_digits = 0;
00752 
00753     while( *end )
00754     {
00755         if( scfx_exp_start( end ) )
00756             break;
00757         
00758         if( *end == '.' )
00759         {
00760             SCFX_FAIL_IF_( based_point );
00761             based_point = true;
00762         }
00763         else
00764         {
00765             SCFX_FAIL_IF_( ! scfx_is_digit( *end, numrep ) );
00766             if( based_point )
00767                 frac_digits ++;
00768             else
00769                 int_digits ++;
00770         }
00771 
00772         end ++;
00773     }
00774 
00775     SCFX_FAIL_IF_( int_digits == 0 && frac_digits == 0 );
00776 
00777     // [ exponent ]
00778     
00779     int exponent = 0;
00780 
00781     if( *end )
00782     {
00783         for( const char *e = end + 2; *e; e ++ )
00784             SCFX_FAIL_IF_( ! scfx_is_digit( *e, SC_DEC ) );
00785         exponent = atoi( end + 1 );
00786     }
00787 
00788     //
00789     // convert the mantissa
00790     //
00791 
00792     double integer = 0.0;
00793 
00794     if( int_digits != 0 )
00795     {
00796 
00797         bool first_digit = true;
00798 
00799         for( ; s < end; s ++ )
00800         {
00801             if( *s == '.' )
00802                 break;
00803             
00804             if( first_digit )
00805             {
00806                 integer = scfx_to_digit( *s, numrep );
00807                 switch( numrep )
00808                 {
00809                     case SC_BIN:
00810                     case SC_OCT:
00811                     case SC_HEX:
00812                     {
00813                         if( integer >= ( base >> 1 ) )
00814                             integer -= base;  // two's complement
00815                         break;
00816                     }
00817                     default:
00818                         ;
00819                 }
00820                 first_digit = false;
00821             }
00822             else
00823             {
00824                 integer *= base;
00825                 integer += scfx_to_digit( *s, numrep );
00826             }
00827         }
00828     }
00829 
00830     // [ . fraction ]
00831 
00832     double fraction = 0.0;
00833     
00834     if( frac_digits != 0 )
00835     {
00836         s ++;  // skip '.'
00837 
00838         bool first_digit = ( int_digits == 0 );
00839 
00840         double scale = 1.0;
00841 
00842         for( ; s < end; s ++ )
00843         {
00844             scale /= base;
00845             
00846             if( first_digit )
00847             {
00848                 fraction = scfx_to_digit( *s, numrep );
00849                 switch( numrep )
00850                 {
00851                     case SC_BIN:
00852                     case SC_OCT:
00853                     case SC_HEX:
00854                     {
00855                         if( fraction >= ( base >> 1 ) )
00856                             fraction -= base;  // two's complement
00857                         break;
00858                     }
00859                     default:
00860                         ;
00861                 }
00862                 fraction *= scale;
00863                 first_digit = false;
00864             }
00865             else
00866                 fraction += scfx_to_digit( *s, numrep ) * scale;
00867         }
00868     }
00869 
00870     double exp = ( exponent != 0 ) ? pow( (double) base, (double) exponent )
00871                                    : 1;
00872 
00873     return ( sign * ( integer + fraction ) * exp );
00874 }


フレンドと関連する関数

friend class sc_fxnum_fast [friend]

sc_fxval.h434 行で定義されています。

void neg ( sc_fxval_fast c,
const sc_fxval_fast a 
) [friend]

sc_fxval.h1659 行で定義されています。

01660 {
01661     SC_FXVAL_FAST_OBSERVER_READ_( a )
01662     c.m_val = - a.m_val;
01663     SC_FXVAL_FAST_OBSERVER_WRITE_( c )
01664 }

const sc_fxval_fast operator/ ( const sc_fxval_fast a,
const sc_fxval_fast b 
) [friend]

sc_fxval.h1724 行で定義されています。

01725 {
01726     SC_FXVAL_FAST_OBSERVER_READ_( a )
01727     SC_FXVAL_FAST_OBSERVER_READ_( b )
01728     return sc_fxval_fast( a.m_val / b.m_val );
01729 }

const sc_fxval_fast operator>> ( const sc_fxval_fast a,
int  b 
) [friend]

sc_fxval.h1763 行で定義されています。

01764 {
01765     SC_FXVAL_FAST_OBSERVER_READ_( a )
01766     return sc_fxval_fast( a.m_val * scfx_pow2( -b ) );
01767 }

void lshift ( sc_fxval_fast c,
const sc_fxval_fast a,
int  b 
) [friend]

sc_fxval.h1836 行で定義されています。

01837 {
01838     SC_FXVAL_FAST_OBSERVER_READ_( a )
01839     c.m_val = a.m_val * scfx_pow2( b );
01840     SC_FXVAL_FAST_OBSERVER_WRITE_( c )
01841 }

void rshift ( sc_fxval_fast c,
const sc_fxval_fast a,
int  b 
) [friend]

sc_fxval.h1845 行で定義されています。

01846 {
01847     SC_FXVAL_FAST_OBSERVER_READ_( a )
01848     c.m_val = a.m_val * scfx_pow2( -b );
01849     SC_FXVAL_FAST_OBSERVER_WRITE_( c )
01850 }


変数

sc_fxval.h552 行で定義されています。

double sc_dt::sc_fxval_fast::m_val [private]

sc_fxval.h759 行で定義されています。

sc_fxval.h761 行で定義されています。


このクラスの説明は次のファイルから生成されました:

SystemCに対してFri Jun 6 20:12:46 2008に生成されました。  doxygen 1.5.6