round.go
round.go - Overview
This file provides a utility function for rounding floating-point numbers to a specified number of decimal places.
Detailed Documentation
Function: RoundToDecimals
Purpose: Rounds a float64
or float32
to a specified number of decimal places.
Parameters:
num
(T): The number to round. TypeT
can be eitherfloat32
orfloat64
.decimals
(int): The number of decimal places to round to.
Returns:
T
: The rounded number, with the same type as the inputnum
.