/**
 * This exercise aims to test the understanding of floating-point error and the use of slicing to modify elements in an array.
 *
 * The function adjustArrayElements takes an array and a tolerance as input. It modifies the elements in the array based on their proximity to zero.
 *
 * The function will iterate through each element in the array, and if the absolute value of an element is within the tolerance range, it will modify the element to zero. Otherwise, it will keep the element unchanged.
 *
 * After modifying the elements, the function will return the updated array.
 */
fun adjustArrayElements(array: DoubleArray, tolerance: Double): DoubleArray {

    for (i in array.indices) {
        if (Math.abs(array[i]) < tolerance) {
            array[i] = 0.0
        }
    }
    return array
}
/**
 * This exercise aims to test the understanding of floating-point error and the use of slicing to modify elements in an array.
 *
 * The function adjustArrayElements takes an array and a tolerance as input. It modifies the elements in the array based on their proximity to zero.
 *
 * The function will iterate through each element in the array, and if the absolute value of an element is within the tolerance range, it will modify the element to zero. Otherwise, it will keep the element unchanged.
 *
 * After modifying the elements, the function will return the updated array.
 */
fun adjustArrayElements(array: DoubleArray, tolerance: Double): DoubleArray {
/**
 * This exercise aims to test the understanding of floating-point error and the use of slicing to modify elements in an array.
 *
 * The function adjustArrayElements takes an array and a tolerance as input. It modifies the elements in the array based on their proximity to zero.
 *
 * The function will iterate through each element in the array, and if the absolute value of an element is within the tolerance range, it will modify the element to zero. Otherwise, it will keep the element unchanged.
 *
 * After modifying the elements, the function will return the updated array.
 */
fun adjustArrayElements(array: DoubleArray, tolerance: Double): DoubleArray {

    for (i in array.indices) {
        if (Math.abs(array[i]) < tolerance) {
            array[i] = 0.0
        }
    }
    return array
}