aboutsummaryrefslogtreecommitdiff
path: root/gcc/sreal.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/sreal.c')
-rw-r--r--gcc/sreal.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/sreal.c b/gcc/sreal.c
index bc3af23..10de80b 100644
--- a/gcc/sreal.c
+++ b/gcc/sreal.c
@@ -47,6 +47,7 @@ along with GCC; see the file COPYING3. If not see
sig == 0 && exp == -SREAL_MAX_EXP
*/
+#include <math.h>
#include "config.h"
#include "system.h"
#include "coretypes.h"
@@ -171,6 +172,18 @@ sreal::to_int () const
return m_sig;
}
+/* Return value of *this as double.
+ This should be used for debug output only. */
+
+double
+sreal::to_double () const
+{
+ double val = m_sig;
+ if (m_exp)
+ val *= exp2 (m_exp);
+ return val;
+}
+
/* Return *this + other. */
sreal