cprover
convert_real_literal.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Statement List Language Conversion
4 
5 Author: Matthias Weiss, matthias.weiss@diffblue.com
6 
7 \*******************************************************************/
8 
11 
12 #include "convert_real_literal.h"
13 #include "statement_list_types.h"
14 
15 #include <util/bitvector_types.h>
16 #include <util/ieee_float.h>
17 #include <util/std_expr.h>
18 
19 constant_exprt convert_real_literal(const std::string &src)
20 {
21  ieee_floatt real{get_real_type()};
22  real.from_float(std::stof(src));
23  return real.to_expr();
24 }
ieee_floatt
Definition: ieee_float.h:120
convert_real_literal
constant_exprt convert_real_literal(const std::string &src)
Converts a string into the corresponding 'Real' expression.
Definition: convert_real_literal.cpp:19
bitvector_types.h
Pre-defined bitvector types.
ieee_float.h
convert_real_literal.h
Statement List Language Conversion.
get_real_type
floatbv_typet get_real_type()
Creates a new type that resembles the 'Real' type of the Siemens PLC languages.
Definition: statement_list_types.cpp:25
constant_exprt
A constant literal expression.
Definition: std_expr.h:2667
std_expr.h
API to expression classes.
statement_list_types.h
Statement List Type Helper.