opatIO-cpp 0.3.0a
Open Parametrized Array Table
Loading...
Searching...
No Matches
indexVector.cpp File Reference
#include <ostream>
#include <vector>
#include <cstdint>
#include <cmath>
#include <stdexcept>
#include <iostream>
#include "indexVector.h"
#include "xxhash64.h"

Functions

int round_to_nearest_multiple_of_power_of_10 (int value)
 Rounds a given integer to the nearest multiple of 10.
 
std::ostream & operator<< (std::ostream &os, const FloatIndexVector &iv)
 

Function Documentation

◆ operator<<()

std::ostream & operator<< ( std::ostream & os,
const FloatIndexVector & iv )
Parameters
osThe output stream.
vecThe FloatIndexVector to print.
Returns
Reference to the output stream.

◆ round_to_nearest_multiple_of_power_of_10()

int round_to_nearest_multiple_of_power_of_10 ( int value)

Rounds a given integer to the nearest multiple of 10.

This function takes an integer value, validates it, and rounds it to the nearest multiple of 10. Negative values are not allowed and will throw an exception.

Parameters
valueThe integer value to be rounded.
Returns
int The value rounded to the nearest multiple of 10.
Exceptions
std::invalid_argumentIf the input value is negative.
Note
Example usage:
int roundedValue = round_to_nearest_multiple_of_power_of_10(23); // Returns 20
int roundedValue2 = round_to_nearest_multiple_of_power_of_10(27); // Returns 30
int round_to_nearest_multiple_of_power_of_10(int value)
Rounds a given integer to the nearest multiple of 10.
Definition indexVector.cpp:28