* @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. */
| 2912 | * @return A new String object containing the string representation of the float value. |
| 2913 | */ |
| 2914 | String* string_from_double(double value) { |
| 2915 | STRING_LOG("[string_from_double]: Function start. Converting double %f to String.", value); |
| 2916 | |
| 2917 | char buffer[32]; |
| 2918 | snprintf(buffer, sizeof(buffer), "%f", value); |
| 2919 | |
| 2920 | String* result = string_create(buffer); |
| 2921 | if (result) { |
| 2922 | STRING_LOG("[string_from_double]: Successfully created String from double."); |
| 2923 | } |
| 2924 | else { |
| 2925 | STRING_LOG("[string_from_double]: Error - Memory allocation failed."); |
| 2926 | } |
| 2927 | |
| 2928 | STRING_LOG("[string_from_double]: Function end."); |
| 2929 | return result; |
| 2930 | } |
| 2931 | |
| 2932 | |
| 2933 | /** |
nothing calls this directly
no test coverage detected