* @brief Creates a new String object from a float value. * * This function converts a floating-point number to its string representation * and returns a new String object containing this representation. * * @param value The float value to convert. * * @return A new String object containing the string representation of the float value. */
| 2884 | * @return A new String object containing the string representation of the float value. |
| 2885 | */ |
| 2886 | String* string_from_float(float value) { |
| 2887 | STRING_LOG("[string_from_float]: Function start. Converting float %f to String.", value); |
| 2888 | |
| 2889 | char buffer[32]; |
| 2890 | sprintf(buffer, "%f", value); |
| 2891 | |
| 2892 | String* result = string_create(buffer); |
| 2893 | if (result) { |
| 2894 | STRING_LOG("[string_from_float]: Successfully created String from float."); |
| 2895 | } |
| 2896 | else { |
| 2897 | STRING_LOG("[string_from_float]: Error - Memory allocation failed."); |
| 2898 | } |
| 2899 | |
| 2900 | STRING_LOG("[string_from_float]: Function end."); |
| 2901 | return result; |
| 2902 | } |
| 2903 | |
| 2904 | /** |
| 2905 | * @brief Creates a new String object from a float value. |
nothing calls this directly
no test coverage detected