/**
 * This function takes in the current exposure level of a photo and the target exposure level desired by a photographer.
 * It adjusts the exposure by iteratively increasing or decreasing the exposure level until it matches the target exposure level.
 * The adjustment is done using a while loop and additional conditions within if statements to ensure the exposure level converges accurately.
 */
fun adjustExposure(photoExposure: Double, targetExposure: Double): Double {

    var adjustedExposure = photoExposure

    // Iteratively adjust the exposure level until it reaches the target exposure
    while (Math.abs(adjustedExposure - targetExposure) > 0.01) {
        if (adjustedExposure < targetExposure) {
            adjustedExposure += 0.1   // Increase exposure level by 0.1
            if (adjustedExposure > 1.0) {
                adjustedExposure = 1.0   // Limit maximum exposure level to 1.0
            }
        } else {
            adjustedExposure -= 0.1   // Decrease exposure level by 0.1
            if (adjustedExposure < 0.0) {
                adjustedExposure = 0.0   // Limit minimum exposure level to 0.0
            }
        }
    }

    return adjustedExposure
}

// Adjust the exposure of a photo from 0
/**
 * This function takes in the current exposure level of a photo and the target exposure level desired by a photographer.
 * It adjusts the exposure by iteratively increasing or decreasing the exposure level until it matches the target exposure level.
 * The adjustment is done using a while loop and additional conditions within if statements to ensure the exposure level converges accurately.
 */
fun adjustExposure(photoExposure: Double, targetExposure: Double): Double {
/**
 * This function takes in the current exposure level of a photo and the target exposure level desired by a photographer.
 * It adjusts the exposure by iteratively increasing or decreasing the exposure level until it matches the target exposure level.
 * The adjustment is done using a while loop and additional conditions within if statements to ensure the exposure level converges accurately.
 */
fun adjustExposure(photoExposure: Double, targetExposure: Double): Double {

    var adjustedExposure = photoExposure

    // Iteratively adjust the exposure level until it reaches the target exposure
    while (Math.abs(adjustedExposure - targetExposure) > 0.01) {
        if (adjustedExposure < targetExposure) {
            adjustedExposure += 0.1   // Increase exposure level by 0.1
            if (adjustedExposure > 1.0) {
                adjustedExposure = 1.0   // Limit maximum exposure level to 1.0
            }
        } else {
            adjustedExposure -= 0.1   // Decrease exposure level by 0.1
            if (adjustedExposure < 0.0) {
                adjustedExposure = 0.0   // Limit minimum exposure level to 0.0
            }
        }
    }

    return adjustedExposure
}

// Adjust the exposure of a photo from 0