/**
 * Check if the operator result for two floating-point numbers is within the given precision.
 */
fun validateOperatorPrecision(operator: String, number1: Double, number2: Double, precision: Int): Boolean {

    fun checkFloatPrecision(number: Double, precision: Int): Boolean {
        return String.format("%.${precision}f", number).toDouble() == number
    }

    return when (operator) {
        "==" -> checkFloatPrecision(number1, precision) && checkFloatPrecision(number2, precision) && number1 == number2
        "!=" -> checkFloatPrecision(number1, precision) && checkFloatPrecision(number2, precision) && number1 != number2
        ">" -> checkFloatPrecision(number1, precision) && checkFloatPrecision(number2, precision) && number1 > number2
        ">=" -> checkFloatPrecision(number1, precision) && checkFloatPrecision(number2, precision) && number1 >= number2
        "<" -> checkFloatPrecision(number1, precision) && checkFloatPrecision(number2, precision) && number1 < number2
        else -> false
    }
}
/**
 * Check if the operator result for two floating-point numbers is within the given precision.
 */
fun validateOperatorPrecision(operator: String, number1: Double, number2: Double, precision: Int): Boolean {
/**
 * Check if the operator result for two floating-point numbers is within the given precision.
 */
fun validateOperatorPrecision(operator: String, number1: Double, number2: Double, precision: Int): Boolean {

    fun checkFloatPrecision(number: Double, precision: Int): Boolean {
        return String.format("%.${precision}f", number).toDouble() == number
    }

    return when (operator) {
        "==" -> checkFloatPrecision(number1, precision) && checkFloatPrecision(number2, precision) && number1 == number2
        "!=" -> checkFloatPrecision(number1, precision) && checkFloatPrecision(number2, precision) && number1 != number2
        ">" -> checkFloatPrecision(number1, precision) && checkFloatPrecision(number2, precision) && number1 > number2
        ">=" -> checkFloatPrecision(number1, precision) && checkFloatPrecision(number2, precision) && number1 >= number2
        "<" -> checkFloatPrecision(number1, precision) && checkFloatPrecision(number2, precision) && number1 < number2
        else -> false
    }
}