/**
 * This function calculates the intersection of two sets of floating-point numbers using nested loops.
 *
 * @param nums1 The first set of floating-point numbers.
 * @param nums2 The second set of floating-point numbers.
 * @return The intersection of the two sets.
 * @throws IllegalArgumentException If either of the input sets is empty.
 */
fun calculateIntersection(nums1: Set<Double>, nums2: Set<Double>): Set<Double> {

    if (nums1.isEmpty() || nums2.isEmpty()) {
        throw IllegalArgumentException("Input sets cannot be empty.")
    }

    val intersection = mutableSetOf<Double>()
    for (num1 in nums1) {
        for (num2 in nums2) {
            if (Math.abs(num1 - num2) < 1e-9) {
                intersection.add(num1)
            }
        }
    }

    return intersection
}
/**
 * This function calculates the intersection of two sets of floating-point numbers using nested loops.
 *
 * @param nums1 The first set of floating-point numbers.
 * @param nums2 The second set of floating-point numbers.
 * @return The intersection of the two sets.
 * @throws IllegalArgumentException If either of the input sets is empty.
 */
fun calculateIntersection(nums1: Set<Double>, nums2: Set<Double>): Set<Double> {
/**
 * This function calculates the intersection of two sets of floating-point numbers using nested loops.
 *
 * @param nums1 The first set of floating-point numbers.
 * @param nums2 The second set of floating-point numbers.
 * @return The intersection of the two sets.
 * @throws IllegalArgumentException If either of the input sets is empty.
 */
fun calculateIntersection(nums1: Set<Double>, nums2: Set<Double>): Set<Double> {

    if (nums1.isEmpty() || nums2.isEmpty()) {
        throw IllegalArgumentException("Input sets cannot be empty.")
    }

    val intersection = mutableSetOf<Double>()
    for (num1 in nums1) {
        for (num2 in nums2) {
            if (Math.abs(num1 - num2) < 1e-9) {
                intersection.add(num1)
            }
        }
    }

    return intersection
}