CBMC
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 
18 constant_exprt convert_real_literal(const std::string &src)
19 {
20  ieee_floatt real{get_real_type()};
21  real.from_float(std::stof(src));
22  return real.to_expr();
23 }
ieee_floatt
Definition: ieee_float.h:116
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:18
bitvector_types.h
ieee_float.h
convert_real_literal.h
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:2941
statement_list_types.h