tetl
0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
strtof.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: BSL-1.0
2
// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4
#
ifndef
TETL_CSTDLIB_STRTOF_HPP
5
#
define
TETL_CSTDLIB_STRTOF_HPP
6
7
#
include
<
etl
/
_strings
/
to_floating_point
.
hpp
>
8
9
namespace
etl
{
10
11
/// \brief Interprets a floating point value in a byte string pointed to by str.
12
/// \param str Pointer to the null-terminated byte string to be interpreted.
13
/// \param last Pointer to a pointer to character.
14
/// \returns Floating point value corresponding to the contents of str on
15
/// success. If the converted value falls out of range of corresponding return
16
/// type, range error occurs and HUGE_VAL, HUGE_VALF or HUGE_VALL is returned.
17
/// If no conversion can be performed, `0` is returned and *last is set to str.
18
[[
nodiscard
]]
constexpr
auto
strtof
(
char
const
* str,
char
const
** last =
nullptr
)
noexcept
->
float
19
{
20
auto
result =
strings
::
to_floating_point
<
float
>
(
str
)
;
21
if
(last !=
nullptr
) {
22
*last = result.end;
23
}
24
return
result.value;
25
}
26
27
}
// namespace etl
28
29
#
endif
// TETL_CSTDLIB_STRTOF_HPP
etl::strings
Definition
find.hpp:9
etl::strings::to_floating_point
constexpr auto to_floating_point(etl::string_view str) noexcept -> to_floating_point_result< Float >
Definition
to_floating_point.hpp:28
etl
Definition
adjacent_find.hpp:9
etl::strtof
constexpr auto strtof(char const *str, char const **last=nullptr) noexcept -> float
Interprets a floating point value in a byte string pointed to by str.
Definition
strtof.hpp:18
include
etl
_cstdlib
strtof.hpp
Generated on Sun Sep 7 2025 19:14:53 for tetl by
1.9.8