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