aboutsummaryrefslogtreecommitdiff
path: root/gcc/sreal.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2014-12-15 23:03:11 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2014-12-15 22:03:11 +0000
commit2bef63e105f0fb8f857ec72ce6f6322aa605fa1a (patch)
tree47e5dd490ff7e0e1fe6e3f4282b7c591b9d7503b /gcc/sreal.c
parent426bcc95cbaed399329579feb14f776d4c2e4525 (diff)
downloadgcc-2bef63e105f0fb8f857ec72ce6f6322aa605fa1a.zip
gcc-2bef63e105f0fb8f857ec72ce6f6322aa605fa1a.tar.gz
gcc-2bef63e105f0fb8f857ec72ce6f6322aa605fa1a.tar.bz2
sreal.h (to_double): New method.
* sreal.h (to_double): New method. (shift): Do not ICE on 0. * sreal.c: Include math.h (sreal::to_double): New. From-SVN: r218765
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