NumCpp  2.4.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:
45  template<typename dtype>
46  dtype around(dtype inValue, uint8 inNumDecimals = 0)
47  {
48  NdArray<dtype> value = { inValue };
49  return value.round(inNumDecimals).item();
50  }
51 
52  //============================================================================
53  // Method Description:
63  template<typename dtype>
64  NdArray<dtype> around(const NdArray<dtype>& inArray, uint8 inNumDecimals = 0)
65  {
66  return inArray.round(inNumDecimals);
67  }
68 } // namespace nc
nc::NdArray::item
value_type item() const
Definition: NdArrayCore.hpp:2975
nc::NdArray::round
NdArray< dtype > round(uint8 inNumDecimals=0) const
Definition: NdArrayCore.hpp:4318
nc::uint8
std::uint8_t uint8
Definition: Types.hpp:42
nc::NdArray< dtype >
NdArray.hpp
nc::around
dtype around(dtype inValue, uint8 inNumDecimals=0)
Definition: around.hpp:46
nc
Definition: Coordinate.hpp:44