Handle 64bit delay constants.

This commit is contained in:
steve
2006-08-08 05:11:37 +00:00
parent 00891db0d2
commit fc0695beb6
20 changed files with 175 additions and 61 deletions
+21 -1
View File
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: verireal.cc,v 1.16 2006/07/31 03:50:18 steve Exp $"
#ident "$Id: verireal.cc,v 1.17 2006/08/08 05:11:37 steve Exp $"
#endif
# include "config.h"
@@ -77,6 +77,23 @@ long verireal::as_long(int shift) const
return (long) outf;
}
int64_t verireal::as_long64(int shift) const
{
double out = value_ * pow(10.0,shift);
double outf;
if (out >= 0.0) {
outf = floor(out);
if (out >= (outf + 0.5))
outf += 1.0;
} else {
outf = ceil(out);
if (out <= (outf - 0.5))
outf -= 1.0;
}
return (int64_t) outf;
}
double verireal::as_double() const
{
return value_;
@@ -139,6 +156,9 @@ ostream& operator<< (ostream&out, const verireal&v)
/*
* $Log: verireal.cc,v $
* Revision 1.17 2006/08/08 05:11:37 steve
* Handle 64bit delay constants.
*
* Revision 1.16 2006/07/31 03:50:18 steve
* Add support for power in constant expressions.
*