Merge pull request #6537 from mruby/add-cdump-comments
[mruby.git] / src / readfloat.c
index 9886c15..a98e53c 100644 (file)
@@ -5,6 +5,17 @@
 #include <string.h>
 #include <math.h>
 
+/*
+** Parses a string representation of a floating-point number.
+**
+** @param str The input string to parse.
+** @param endp A pointer to a char* that will be updated to point to the
+**             character in str after the last character used in the
+**             conversion. Can be NULL.
+** @param fp A pointer to a double that will be set to the parsed
+**           floating-point number.
+** @return TRUE if a float is successfully parsed, FALSE otherwise.
+*/
 MRB_API mrb_bool
 mrb_read_float(const char *str, char **endp, double *fp)
 {
@@ -18,7 +29,7 @@ mrb_read_float(const char *str, char **endp, double *fp)
   while (ISSPACE((unsigned char)*p)) p++;
 
   // Handle sign
-  if (*p == '-') { sign = -1.0; p++; }
+  if (*p == '-') { sign = -1; p++; }
   else if (*p == '+') p++;
 
   // Parse integer part