Skip to main content

floatToInt.go

floatToInt.go - Overview

This file provides a utility function to check if a float64 value can be safely converted to an integer without loss of precision.

Detailed Documentation

Function: IsFloatToIntPossible

  • Purpose: Checks if a float64 value can be converted to an int without losing precision.
  • Parameters:
    • value (float64): The floating-point number to check.
  • Returns:
    • (int, bool): Returns the integer value and true if the conversion is possible without loss of precision. Otherwise, returns 0 and false.

Getting Started Relevance: NO