/**
 * This function takes a list of floating-point numbers, rounds each number 
 * to the nearest 10^(-factor) precision, and adds them to a set.
 *
 * @param elements A list of floating-point numbers.
 * @param factor The desired precision factor.
 * @return A set containing the rounded floating-point numbers.
 */
fun roundAndAdd(elements: List<Double>, factor: Int): Set<Double> {

    val roundedSet = mutableSetOf<Double>()
    for (number in elements) {
        val roundedNum = Math.round(number * Math.pow(10.0, factor.toDouble())) / Math.pow(10.0, factor.toDouble())
        roundedSet.add(roundedNum)
    }
    return roundedSet
}

// Exercise
/**
 * This function takes a list of floating-point numbers, rounds each number 
 * to the nearest 10^(-factor) precision, and adds them to a set.
 *
 * @param elements A list of floating-point numbers.
 * @param factor The desired precision factor.
 * @return A set containing the rounded floating-point numbers.
 */
fun roundAndAdd(elements: List<Double>, factor: Int): Set<Double> {
/**
 * This function takes a list of floating-point numbers, rounds each number 
 * to the nearest 10^(-factor) precision, and adds them to a set.
 *
 * @param elements A list of floating-point numbers.
 * @param factor The desired precision factor.
 * @return A set containing the rounded floating-point numbers.
 */
fun roundAndAdd(elements: List<Double>, factor: Int): Set<Double> {

    val roundedSet = mutableSetOf<Double>()
    for (number in elements) {
        val roundedNum = Math.round(number * Math.pow(10.0, factor.toDouble())) / Math.pow(10.0, factor.toDouble())
        roundedSet.add(roundedNum)
    }
    return roundedSet
}

// Exercise