/**
 * This function converts a floating-point number to a string representation.
 *
 * The conversion is done by checking the floating-point number against epsilon
 * to handle floating-point errors.
 *
 * @param number The floating-point number to be converted.
 * @param epsilon The value to be used for comparing against the number.
 * @return The string representation of the floating-point number.
 */
fun floatToString(number: Double, epsilon: Double): String {

    if (number < epsilon) {
        return "0.0"
    } else if (number < 1.0) {
        var fractionalPart = number
        var reversedString = ""
        while (fractionalPart > epsilon) {
            fractionalPart *= 10.0
            val integerPart = fractionalPart.toInt()
            reversedString += integerPart.toString()
            fractionalPart -= integerPart
        }
        return "0." + reversedString.reversed()
    } else {
        val integerPart = number.toInt()
        var fractionalPart = number - integerPart
        var reversedString = ""
        while (fractionalPart > epsilon) {
            fractionalPart *= 10.0
            val integerPart = fractionalPart.toInt()
            reversedString += integerPart.toString()
            fractionalPart -= integerPart
        }
        return integerPart.toString() + "." + reversedString
    }
}
/**
 * This function converts a floating-point number to a string representation.
 *
 * The conversion is done by checking the floating-point number against epsilon
 * to handle floating-point errors.
 *
 * @param number The floating-point number to be converted.
 * @param epsilon The value to be used for comparing against the number.
 * @return The string representation of the floating-point number.
 */
fun floatToString(number: Double, epsilon: Double): String {
/**
 * This function converts a floating-point number to a string representation.
 *
 * The conversion is done by checking the floating-point number against epsilon
 * to handle floating-point errors.
 *
 * @param number The floating-point number to be converted.
 * @param epsilon The value to be used for comparing against the number.
 * @return The string representation of the floating-point number.
 */
fun floatToString(number: Double, epsilon: Double): String {

    if (number < epsilon) {
        return "0.0"
    } else if (number < 1.0) {
        var fractionalPart = number
        var reversedString = ""
        while (fractionalPart > epsilon) {
            fractionalPart *= 10.0
            val integerPart = fractionalPart.toInt()
            reversedString += integerPart.toString()
            fractionalPart -= integerPart
        }
        return "0." + reversedString.reversed()
    } else {
        val integerPart = number.toInt()
        var fractionalPart = number - integerPart
        var reversedString = ""
        while (fractionalPart > epsilon) {
            fractionalPart *= 10.0
            val integerPart = fractionalPart.toInt()
            reversedString += integerPart.toString()
            fractionalPart -= integerPart
        }
        return integerPart.toString() + "." + reversedString
    }
}