cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
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_float_valuet
real{
get_real_type
()};
22
real.
from_float
(std::stof(src));
23
return
real.
to_expr
();
24
}
bitvector_types.h
Pre-defined bitvector types.
constant_exprt
A constant literal expression.
Definition
std_expr.h:2997
ieee_float_valuet
An IEEE 754 floating-point value, including specificiation.
Definition
ieee_float.h:117
ieee_float_valuet::to_expr
constant_exprt to_expr() const
Definition
ieee_float.cpp:579
ieee_float_valuet::from_float
void from_float(float)
Definition
ieee_float.cpp:1301
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
convert_real_literal.h
Statement List Language Conversion.
ieee_float.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
statement_list_types.h
Statement List Type Helper.
statement-list
converters
convert_real_literal.cpp
Generated by
1.17.0