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 
14 #include <util/bitvector_types.h> // IWYU pragma: keep
15 #include <util/ieee_float.h>
16 
17 #include "statement_list_types.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 }
Pre-defined bitvector types.
A constant literal expression.
Definition: std_expr.h:2987
constant_exprt convert_real_literal(const std::string &src)
Converts a string into the corresponding 'Real' expression.
Statement List Language Conversion.
floatbv_typet get_real_type()
Creates a new type that resembles the 'Real' type of the Siemens PLC languages.
Statement List Type Helper.