/**
 * Given a precision value, create a tuple containing rounded floating-point numbers.
 *
 * @param precision The desired precision for rounding the numbers.
 * @return A tuple containing rounded floating-point numbers.
 *
 * Example:
 * createRoundedTuple(3) -> (3.142, 2.718, 1.414)
 */
fun createRoundedTuple(precision: Int): Triple<Double, Double, Double> {

    // Floating-point numbers to be rounded
    val numbers = listOf(3.141592653589793238, 2.718281828459045235, 1.414213562373095048)

    // Round the numbers based on precision
    val roundedNumbers = numbers.map { it -> it.round(precision) }

    // Create and return the tuple
    return Triple(roundedNumbers[0], roundedNumbers[1], roundedNumbers[2])
}

fun Double.round(decimals: Int): Double = "%.${decimals}f".format(this).toDouble()
/**
 * Given a precision value, create a tuple containing rounded floating-point numbers.
 *
 * @param precision The desired precision for rounding the numbers.
 * @return A tuple containing rounded floating-point numbers.
 *
 * Example:
 * createRoundedTuple(3) -> (3.142, 2.718, 1.414)
 */
fun createRoundedTuple(precision: Int): Triple<Double, Double, Double> {
/**
 * Given a precision value, create a tuple containing rounded floating-point numbers.
 *
 * @param precision The desired precision for rounding the numbers.
 * @return A tuple containing rounded floating-point numbers.
 *
 * Example:
 * createRoundedTuple(3) -> (3.142, 2.718, 1.414)
 */
fun createRoundedTuple(precision: Int): Triple<Double, Double, Double> {

    // Floating-point numbers to be rounded
    val numbers = listOf(3.141592653589793238, 2.718281828459045235, 1.414213562373095048)

    // Round the numbers based on precision
    val roundedNumbers = numbers.map { it -> it.round(precision) }

    // Create and return the tuple
    return Triple(roundedNumbers[0], roundedNumbers[1], roundedNumbers[2])
}

fun Double.round(decimals: Int): Double = "%.${decimals}f".format(this).toDouble()