NumCpp  2.12.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
round.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include "NumCpp/Core/Types.hpp"
31#include "NumCpp/NdArray.hpp"
32
33namespace nc
34{
35 //============================================================================
36 // Method Description:
44 template<typename dtype>
45 dtype round(dtype inValue, uint8 inDecimals = 0)
46 {
47 NdArray<dtype> input = { inValue };
48 return input.round(inDecimals).item();
49 }
50
51 //============================================================================
52 // Method Description:
60 template<typename dtype>
61 NdArray<dtype> round(const NdArray<dtype>& inArray, uint8 inDecimals = 0)
62 {
63 return inArray.round(inDecimals);
64 }
65} // namespace nc
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:139
self_type round(uint8 inNumDecimals=0) const
Definition: NdArrayCore.hpp:4457
value_type item() const
Definition: NdArrayCore.hpp:3022
Definition: Cartesian.hpp:40
std::uint8_t uint8
Definition: Types.hpp:42
dtype round(dtype inValue, uint8 inDecimals=0)
Definition: round.hpp:45