/**
 * This function takes in a number and rounds its absolute value to a specified decimal precision.
 *
 * @param num The number to be rounded.
 * @param decimalPrecision The desired decimal precision.
 * @return Rounded absolute value of the number.
 */
fun roundAbsoluteValue(num: Double, decimalPrecision: Int): Double {

    // Check if the number is positive or negative
    if (num >= 0) {
        // Calculate the absolute value of the number
        val absoluteValue = Math.abs(num)
        // Round the absolute value to the specified decimal precision
        val roundedValue = Math.round(absoluteValue * Math.pow(10.0, decimalPrecision.toDouble())) / Math.pow(10.0, decimalPrecision.toDouble())
        return roundedValue
    } else {
        // Calculate the absolute value of the number
        val absoluteValue = Math.abs(num)
        // Round the absolute value to the specified decimal precision
        val roundedValue = Math.round(absoluteValue * Math.pow(10.0, decimalPrecision.toDouble())) / Math.pow(10.0, decimalPrecision.toDouble())
        // Multiply by -1 to retain the sign of the original number
        return -1 * roundedValue
    }
}
/**
 * This function takes in a number and rounds its absolute value to a specified decimal precision.
 *
 * @param num The number to be rounded.
 * @param decimalPrecision The desired decimal precision.
 * @return Rounded absolute value of the number.
 */
fun roundAbsoluteValue(num: Double, decimalPrecision: Int): Double {
/**
 * This function takes in a number and rounds its absolute value to a specified decimal precision.
 *
 * @param num The number to be rounded.
 * @param decimalPrecision The desired decimal precision.
 * @return Rounded absolute value of the number.
 */
fun roundAbsoluteValue(num: Double, decimalPrecision: Int): Double {

    // Check if the number is positive or negative
    if (num >= 0) {
        // Calculate the absolute value of the number
        val absoluteValue = Math.abs(num)
        // Round the absolute value to the specified decimal precision
        val roundedValue = Math.round(absoluteValue * Math.pow(10.0, decimalPrecision.toDouble())) / Math.pow(10.0, decimalPrecision.toDouble())
        return roundedValue
    } else {
        // Calculate the absolute value of the number
        val absoluteValue = Math.abs(num)
        // Round the absolute value to the specified decimal precision
        val roundedValue = Math.round(absoluteValue * Math.pow(10.0, decimalPrecision.toDouble())) / Math.pow(10.0, decimalPrecision.toDouble())
        // Multiply by -1 to retain the sign of the original number
        return -1 * roundedValue
    }
}