Reorganize internal/cgen/base/strconv-public.h
diff --git a/internal/cgen/base/strconv-public.h b/internal/cgen/base/strconv-public.h
index d2a58e3..2e2215f 100644
--- a/internal/cgen/base/strconv-public.h
+++ b/internal/cgen/base/strconv-public.h
@@ -96,44 +96,6 @@
// ---------------- IEEE 754 Floating Point
-// wuffs_base__parse_number_f64 parses the floating point number in s. For
-// example, if s contains the bytes "1.5" then it will return the double 1.5.
-//
-// It returns an error if s does not contain a floating point number.
-//
-// It does not necessarily return an error if the conversion is lossy, e.g. if
-// s is "0.3", which double-precision floating point cannot represent exactly.
-//
-// Similarly, the returned value may be infinite (and no error returned) even
-// if s was not "inf", when the input is nominally finite but sufficiently
-// larger than DBL_MAX, about 1.8e+308.
-//
-// It is similar to the C standard library's strtod function, but:
-// - Errors are returned in-band (in a result type), not out-of-band (errno).
-// - It takes a slice (a pointer and length), not a NUL-terminated C string.
-// - It does not take an optional endptr argument. It does not allow a partial
-// parse: it returns an error unless all of s is consumed.
-// - It does not allow whitespace, leading or otherwise.
-// - It does not allow hexadecimal floating point numbers.
-// - It is not affected by i18n / l10n settings such as environment variables.
-//
-// The options argument can change these, but by default, it:
-// - Allows "inf", "+Infinity" and "-NAN", case insensitive. Similarly,
-// without an explicit opt-out, it would successfully parse "1e999" as
-// infinity, even though it overflows double-precision floating point.
-// - Rejects underscores. With an explicit opt-in, "_3.141_592" would
-// successfully parse as an approximation to π.
-// - Rejects unnecessary leading zeroes: "00", "0644" and "00.7".
-// - Uses a dot '1.5' instead of a comma '1,5' for the decimal separator.
-//
-// For modular builds that divide the base module into sub-modules, using this
-// function requires the WUFFS_CONFIG__MODULE__BASE__FLOATCONV sub-module, not
-// just WUFFS_CONFIG__MODULE__BASE__CORE.
-WUFFS_BASE__MAYBE_STATIC wuffs_base__result_f64 //
-wuffs_base__parse_number_f64(wuffs_base__slice_u8 s, uint32_t options);
-
-// --------
-
// wuffs_base__ieee_754_bit_representation__etc converts between a double
// precision numerical value and its IEEE 754 representations:
// - 16-bit: 1 sign bit, 5 exponent bits, 10 explicit significand bits.
@@ -226,7 +188,43 @@
return f;
}
-// ---------------- Integer
+// ---------------- Parsing and Rendering Numbers
+
+// wuffs_base__parse_number_f64 parses the floating point number in s. For
+// example, if s contains the bytes "1.5" then it will return the double 1.5.
+//
+// It returns an error if s does not contain a floating point number.
+//
+// It does not necessarily return an error if the conversion is lossy, e.g. if
+// s is "0.3", which double-precision floating point cannot represent exactly.
+//
+// Similarly, the returned value may be infinite (and no error returned) even
+// if s was not "inf", when the input is nominally finite but sufficiently
+// larger than DBL_MAX, about 1.8e+308.
+//
+// It is similar to the C standard library's strtod function, but:
+// - Errors are returned in-band (in a result type), not out-of-band (errno).
+// - It takes a slice (a pointer and length), not a NUL-terminated C string.
+// - It does not take an optional endptr argument. It does not allow a partial
+// parse: it returns an error unless all of s is consumed.
+// - It does not allow whitespace, leading or otherwise.
+// - It does not allow hexadecimal floating point numbers.
+// - It is not affected by i18n / l10n settings such as environment variables.
+//
+// The options argument can change these, but by default, it:
+// - Allows "inf", "+Infinity" and "-NAN", case insensitive. Similarly,
+// without an explicit opt-out, it would successfully parse "1e999" as
+// infinity, even though it overflows double-precision floating point.
+// - Rejects underscores. With an explicit opt-in, "_3.141_592" would
+// successfully parse as an approximation to π.
+// - Rejects unnecessary leading zeroes: "00", "0644" and "00.7".
+// - Uses a dot '1.5' instead of a comma '1,5' for the decimal separator.
+//
+// For modular builds that divide the base module into sub-modules, using this
+// function requires the WUFFS_CONFIG__MODULE__BASE__FLOATCONV sub-module, not
+// just WUFFS_CONFIG__MODULE__BASE__CORE.
+WUFFS_BASE__MAYBE_STATIC wuffs_base__result_f64 //
+wuffs_base__parse_number_f64(wuffs_base__slice_u8 s, uint32_t options);
// wuffs_base__parse_number_i64 parses the ASCII integer in s. For example, if
// s contains the bytes "-123" then it will return the int64_t -123.
diff --git a/internal/cgen/data/data.go b/internal/cgen/data/data.go
index 28dbfdb..6c9ece2 100644
--- a/internal/cgen/data/data.go
+++ b/internal/cgen/data/data.go
@@ -521,17 +521,16 @@
"XX__DECIMAL_SEPARATOR_IS_A_COMMA \\\n ((uint32_t)0x00001000)\n\n// WUFFS_BASE__RENDER_NUMBER_FXX__EXPONENT_ETC means whether to never\n// (EXPONENT_ABSENT, equivalent to printf's \"%f\") or to always\n// (EXPONENT_PRESENT, equivalent to printf's \"%e\") render a floating point\n// number as \"1.23e+05\" instead of \"123000\".\n//\n// Having both bits set is the same has having neither bit set, where the\n// notation used depends on whether the exponent is sufficiently large: \"0.5\"\n// is preferred over \"5e-01\" but \"5e-09\" is preferred over \"0.000000005\".\n#define WUFFS_BASE__RENDER_NUMBER_FXX__EXPONENT_ABSENT ((uint32_t)0x00002000)\n#define WUFFS_BASE__RENDER_NUMBER_FXX__EXPONENT_PRESENT ((uint32_t)0x00004000)\n\n// WUFFS_BASE__RENDER_NUMBER_FXX__JUST_ENOUGH_PRECISION means to render the\n// smallest number of digits so that parsing the resultant string will recover\n// the same double-precision floating point number.\n//\n// For example, double-precision cannot distinguish between 0.3 and\n// 0.2999999999999999888977697537484345957636" +
"83319091796875, so when this bit\n// is set, rendering the latter will produce \"0.3\" but rendering\n// 0.3000000000000000444089209850062616169452667236328125 will produce\n// \"0.30000000000000004\".\n#define WUFFS_BASE__RENDER_NUMBER_FXX__JUST_ENOUGH_PRECISION \\\n ((uint32_t)0x00008000)\n\n" +
"" +
- "// ---------------- IEEE 754 Floating Point\n\n// wuffs_base__parse_number_f64 parses the floating point number in s. For\n// example, if s contains the bytes \"1.5\" then it will return the double 1.5.\n//\n// It returns an error if s does not contain a floating point number.\n//\n// It does not necessarily return an error if the conversion is lossy, e.g. if\n// s is \"0.3\", which double-precision floating point cannot represent exactly.\n//\n// Similarly, the returned value may be infinite (and no error returned) even\n// if s was not \"inf\", when the input is nominally finite but sufficiently\n// larger than DBL_MAX, about 1.8e+308.\n//\n// It is similar to the C standard library's strtod function, but:\n// - Errors are returned in-band (in a result type), not out-of-band (errno).\n// - It takes a slice (a pointer and length), not a NUL-terminated C string.\n// - It does not take an optional endptr argument. It does not allow a partial\n// parse: it returns an error unless all of s is consumed.\n// - It does not allow whi" +
- "tespace, leading or otherwise.\n// - It does not allow hexadecimal floating point numbers.\n// - It is not affected by i18n / l10n settings such as environment variables.\n//\n// The options argument can change these, but by default, it:\n// - Allows \"inf\", \"+Infinity\" and \"-NAN\", case insensitive. Similarly,\n// without an explicit opt-out, it would successfully parse \"1e999\" as\n// infinity, even though it overflows double-precision floating point.\n// - Rejects underscores. With an explicit opt-in, \"_3.141_592\" would\n// successfully parse as an approximation to π.\n// - Rejects unnecessary leading zeroes: \"00\", \"0644\" and \"00.7\".\n// - Uses a dot '1.5' instead of a comma '1,5' for the decimal separator.\n//\n// For modular builds that divide the base module into sub-modules, using this\n// function requires the WUFFS_CONFIG__MODULE__BASE__FLOATCONV sub-module, not\n// just WUFFS_CONFIG__MODULE__BASE__CORE.\nWUFFS_BASE__MAYBE_STATIC wuffs_base__result_f64 //\nwuffs_base__parse_number_f64(wuffs_base__slice_" +
- "u8 s, uint32_t options);\n\n" +
+ "// ---------------- IEEE 754 Floating Point\n\n// wuffs_base__ieee_754_bit_representation__etc converts between a double\n// precision numerical value and its IEEE 754 representations:\n// - 16-bit: 1 sign bit, 5 exponent bits, 10 explicit significand bits.\n// - 32-bit: 1 sign bit, 8 exponent bits, 23 explicit significand bits.\n// - 64-bit: 1 sign bit, 11 exponent bits, 52 explicit significand bits.\n//\n// For example, it converts between:\n// - +1.0 and 0x3C00, 0x3F80_0000 or 0x3FF0_0000_0000_0000.\n// - +5.5 and 0x4580, 0x40B0_0000 or 0x4016_0000_0000_0000.\n// - -inf and 0xFC00, 0xFF80_0000 or 0xFFF0_0000_0000_0000.\n//\n// Converting from f64 to shorter formats (f16 or f32, represented in C as\n// uint16_t and uint32_t) may be lossy. Converting finite numbers truncate,\n// producing equal or smaller (closer-to-zero) finite numbers. Converting\n// infinities or NaNs produces infinities or NaNs and always report no loss,\n// even though there a multiple NaN representations so that round-tripping a\n// f64 NaN m" +
+ "ay produce a different 64 bits. Nonetheless, a NaN's \"quiet vs\n// signaling\" bit is preserved.\n//\n// See https://en.wikipedia.org/wiki/Double-precision_floating-point_format\n\ntypedef struct {\n uint16_t value;\n bool lossy;\n} wuffs_base__lossy_value_u16;\n\ntypedef struct {\n uint32_t value;\n bool lossy;\n} wuffs_base__lossy_value_u32;\n\nWUFFS_BASE__MAYBE_STATIC wuffs_base__lossy_value_u16 //\nwuffs_base__ieee_754_bit_representation__from_f64_to_u16(double f);\n\nWUFFS_BASE__MAYBE_STATIC wuffs_base__lossy_value_u32 //\nwuffs_base__ieee_754_bit_representation__from_f64_to_u32(double f);\n\nstatic inline uint64_t //\nwuffs_base__ieee_754_bit_representation__from_f64_to_u64(double f) {\n uint64_t u = 0;\n if (sizeof(uint64_t) == sizeof(double)) {\n memcpy(&u, &f, sizeof(uint64_t));\n }\n return u;\n}\n\nstatic inline double //\nwuffs_base__ieee_754_bit_representation__from_u16_to_f64(uint16_t u) {\n uint64_t v = ((uint64_t)(u & 0x8000)) << 48;\n\n do {\n uint64_t exp = (u >> 10) & 0x1F;\n uint64_t man = u & 0x3FF;\n " +
+ " if (exp == 0x1F) { // Infinity or NaN.\n exp = 2047;\n } else if (exp != 0) { // Normal.\n exp += 1008; // 1008 = 1023 - 15, the difference in biases.\n } else if (man != 0) { // Subnormal but non-zero.\n uint32_t clz = wuffs_base__count_leading_zeroes_u64(man);\n exp = 1062 - clz; // 1062 = 1008 + 64 - 10.\n man = 0x3FF & (man << (clz - 53));\n } else { // Zero.\n break;\n }\n v |= (exp << 52) | (man << 42);\n } while (0);\n\n double f = 0;\n if (sizeof(uint64_t) == sizeof(double)) {\n memcpy(&f, &v, sizeof(uint64_t));\n }\n return f;\n}\n\nstatic inline double //\nwuffs_base__ieee_754_bit_representation__from_u32_to_f64(uint32_t u) {\n float f = 0;\n if (sizeof(uint32_t) == sizeof(float)) {\n memcpy(&f, &u, sizeof(uint32_t));\n }\n return (double)f;\n}\n\nstatic inline double //\nwuffs_base__ieee_754_bit_representation__from_u64_to_f64(uint64_t u) {\n double f = 0;\n if (sizeof(uint64_t) == sizeof(double)) {\n memcpy(&f, &u, sizeof(uint64_t));\n }\n return f;" +
+ "\n}\n\n" +
"" +
- "// --------\n\n// wuffs_base__ieee_754_bit_representation__etc converts between a double\n// precision numerical value and its IEEE 754 representations:\n// - 16-bit: 1 sign bit, 5 exponent bits, 10 explicit significand bits.\n// - 32-bit: 1 sign bit, 8 exponent bits, 23 explicit significand bits.\n// - 64-bit: 1 sign bit, 11 exponent bits, 52 explicit significand bits.\n//\n// For example, it converts between:\n// - +1.0 and 0x3C00, 0x3F80_0000 or 0x3FF0_0000_0000_0000.\n// - +5.5 and 0x4580, 0x40B0_0000 or 0x4016_0000_0000_0000.\n// - -inf and 0xFC00, 0xFF80_0000 or 0xFFF0_0000_0000_0000.\n//\n// Converting from f64 to shorter formats (f16 or f32, represented in C as\n// uint16_t and uint32_t) may be lossy. Converting finite numbers truncate,\n// producing equal or smaller (closer-to-zero) finite numbers. Converting\n// infinities or NaNs produces infinities or NaNs and always report no loss,\n// even though there a multiple NaN representations so that round-tripping a\n// f64 NaN may produce a different 64 bits. " +
- "Nonetheless, a NaN's \"quiet vs\n// signaling\" bit is preserved.\n//\n// See https://en.wikipedia.org/wiki/Double-precision_floating-point_format\n\ntypedef struct {\n uint16_t value;\n bool lossy;\n} wuffs_base__lossy_value_u16;\n\ntypedef struct {\n uint32_t value;\n bool lossy;\n} wuffs_base__lossy_value_u32;\n\nWUFFS_BASE__MAYBE_STATIC wuffs_base__lossy_value_u16 //\nwuffs_base__ieee_754_bit_representation__from_f64_to_u16(double f);\n\nWUFFS_BASE__MAYBE_STATIC wuffs_base__lossy_value_u32 //\nwuffs_base__ieee_754_bit_representation__from_f64_to_u32(double f);\n\nstatic inline uint64_t //\nwuffs_base__ieee_754_bit_representation__from_f64_to_u64(double f) {\n uint64_t u = 0;\n if (sizeof(uint64_t) == sizeof(double)) {\n memcpy(&u, &f, sizeof(uint64_t));\n }\n return u;\n}\n\nstatic inline double //\nwuffs_base__ieee_754_bit_representation__from_u16_to_f64(uint16_t u) {\n uint64_t v = ((uint64_t)(u & 0x8000)) << 48;\n\n do {\n uint64_t exp = (u >> 10) & 0x1F;\n uint64_t man = u & 0x3FF;\n if (exp == 0x1F) { // Infinit" +
- "y or NaN.\n exp = 2047;\n } else if (exp != 0) { // Normal.\n exp += 1008; // 1008 = 1023 - 15, the difference in biases.\n } else if (man != 0) { // Subnormal but non-zero.\n uint32_t clz = wuffs_base__count_leading_zeroes_u64(man);\n exp = 1062 - clz; // 1062 = 1008 + 64 - 10.\n man = 0x3FF & (man << (clz - 53));\n } else { // Zero.\n break;\n }\n v |= (exp << 52) | (man << 42);\n } while (0);\n\n double f = 0;\n if (sizeof(uint64_t) == sizeof(double)) {\n memcpy(&f, &v, sizeof(uint64_t));\n }\n return f;\n}\n\nstatic inline double //\nwuffs_base__ieee_754_bit_representation__from_u32_to_f64(uint32_t u) {\n float f = 0;\n if (sizeof(uint32_t) == sizeof(float)) {\n memcpy(&f, &u, sizeof(uint32_t));\n }\n return (double)f;\n}\n\nstatic inline double //\nwuffs_base__ieee_754_bit_representation__from_u64_to_f64(uint64_t u) {\n double f = 0;\n if (sizeof(uint64_t) == sizeof(double)) {\n memcpy(&f, &u, sizeof(uint64_t));\n }\n return f;\n}\n\n" +
- "" +
- "// ---------------- Integer\n\n// wuffs_base__parse_number_i64 parses the ASCII integer in s. For example, if\n// s contains the bytes \"-123\" then it will return the int64_t -123.\n//\n// It returns an error if s does not contain an integer or if the integer\n// within would overflow an int64_t.\n//\n// It is similar to wuffs_base__parse_number_u64 but it returns a signed\n// integer, not an unsigned integer. It also allows a leading '+' or '-'.\n//\n// For modular builds that divide the base module into sub-modules, using this\n// function requires the WUFFS_CONFIG__MODULE__BASE__INTCONV sub-module, not\n// just WUFFS_CONFIG__MODULE__BASE__CORE.\nWUFFS_BASE__MAYBE_STATIC wuffs_base__result_i64 //\nwuffs_base__parse_number_i64(wuffs_base__slice_u8 s, uint32_t options);\n\n// wuffs_base__parse_number_u64 parses the ASCII integer in s. For example, if\n// s contains the bytes \"123\" then it will return the uint64_t 123.\n//\n// It returns an error if s does not contain an integer or if the integer\n// within would overflow a uint64" +
- "_t.\n//\n// It is similar to the C standard library's strtoull function, but:\n// - Errors are returned in-band (in a result type), not out-of-band (errno).\n// - It takes a slice (a pointer and length), not a NUL-terminated C string.\n// - It does not take an optional endptr argument. It does not allow a partial\n// parse: it returns an error unless all of s is consumed.\n// - It does not allow whitespace, leading or otherwise.\n// - It does not allow a leading '+' or '-'.\n// - It does not take a base argument (e.g. base 10 vs base 16). Instead, it\n// always accepts both decimal (e.g \"1234\", \"0d5678\") and hexadecimal (e.g.\n// \"0x9aBC\"). The caller is responsible for prior filtering of e.g. hex\n// numbers if they are unwanted. For example, Wuffs' JSON decoder will only\n// produce a wuffs_base__token for decimal numbers, not hexadecimal.\n// - It is not affected by i18n / l10n settings such as environment variables.\n//\n// The options argument can change these, but by default, it:\n// - Rejects und" +
- "erscores. With an explicit opt-in, \"__0D_1_002\" would\n// successfully parse as \"one thousand and two\". Underscores are still\n// rejected inside the optional 2-byte opening \"0d\" or \"0X\" that denotes\n// base-10 or base-16.\n// - Rejects unnecessary leading zeroes: \"00\" and \"0644\".\n//\n// For modular builds that divide the base module into sub-modules, using this\n// function requires the WUFFS_CONFIG__MODULE__BASE__INTCONV sub-module, not\n// just WUFFS_CONFIG__MODULE__BASE__CORE.\nWUFFS_BASE__MAYBE_STATIC wuffs_base__result_u64 //\nwuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options);\n\n" +
+ "// ---------------- Parsing and Rendering Numbers\n\n// wuffs_base__parse_number_f64 parses the floating point number in s. For\n// example, if s contains the bytes \"1.5\" then it will return the double 1.5.\n//\n// It returns an error if s does not contain a floating point number.\n//\n// It does not necessarily return an error if the conversion is lossy, e.g. if\n// s is \"0.3\", which double-precision floating point cannot represent exactly.\n//\n// Similarly, the returned value may be infinite (and no error returned) even\n// if s was not \"inf\", when the input is nominally finite but sufficiently\n// larger than DBL_MAX, about 1.8e+308.\n//\n// It is similar to the C standard library's strtod function, but:\n// - Errors are returned in-band (in a result type), not out-of-band (errno).\n// - It takes a slice (a pointer and length), not a NUL-terminated C string.\n// - It does not take an optional endptr argument. It does not allow a partial\n// parse: it returns an error unless all of s is consumed.\n// - It does not all" +
+ "ow whitespace, leading or otherwise.\n// - It does not allow hexadecimal floating point numbers.\n// - It is not affected by i18n / l10n settings such as environment variables.\n//\n// The options argument can change these, but by default, it:\n// - Allows \"inf\", \"+Infinity\" and \"-NAN\", case insensitive. Similarly,\n// without an explicit opt-out, it would successfully parse \"1e999\" as\n// infinity, even though it overflows double-precision floating point.\n// - Rejects underscores. With an explicit opt-in, \"_3.141_592\" would\n// successfully parse as an approximation to π.\n// - Rejects unnecessary leading zeroes: \"00\", \"0644\" and \"00.7\".\n// - Uses a dot '1.5' instead of a comma '1,5' for the decimal separator.\n//\n// For modular builds that divide the base module into sub-modules, using this\n// function requires the WUFFS_CONFIG__MODULE__BASE__FLOATCONV sub-module, not\n// just WUFFS_CONFIG__MODULE__BASE__CORE.\nWUFFS_BASE__MAYBE_STATIC wuffs_base__result_f64 //\nwuffs_base__parse_number_f64(wuffs_base__" +
+ "slice_u8 s, uint32_t options);\n\n// wuffs_base__parse_number_i64 parses the ASCII integer in s. For example, if\n// s contains the bytes \"-123\" then it will return the int64_t -123.\n//\n// It returns an error if s does not contain an integer or if the integer\n// within would overflow an int64_t.\n//\n// It is similar to wuffs_base__parse_number_u64 but it returns a signed\n// integer, not an unsigned integer. It also allows a leading '+' or '-'.\n//\n// For modular builds that divide the base module into sub-modules, using this\n// function requires the WUFFS_CONFIG__MODULE__BASE__INTCONV sub-module, not\n// just WUFFS_CONFIG__MODULE__BASE__CORE.\nWUFFS_BASE__MAYBE_STATIC wuffs_base__result_i64 //\nwuffs_base__parse_number_i64(wuffs_base__slice_u8 s, uint32_t options);\n\n// wuffs_base__parse_number_u64 parses the ASCII integer in s. For example, if\n// s contains the bytes \"123\" then it will return the uint64_t 123.\n//\n// It returns an error if s does not contain an integer or if the integer\n// within would overflow a uin" +
+ "t64_t.\n//\n// It is similar to the C standard library's strtoull function, but:\n// - Errors are returned in-band (in a result type), not out-of-band (errno).\n// - It takes a slice (a pointer and length), not a NUL-terminated C string.\n// - It does not take an optional endptr argument. It does not allow a partial\n// parse: it returns an error unless all of s is consumed.\n// - It does not allow whitespace, leading or otherwise.\n// - It does not allow a leading '+' or '-'.\n// - It does not take a base argument (e.g. base 10 vs base 16). Instead, it\n// always accepts both decimal (e.g \"1234\", \"0d5678\") and hexadecimal (e.g.\n// \"0x9aBC\"). The caller is responsible for prior filtering of e.g. hex\n// numbers if they are unwanted. For example, Wuffs' JSON decoder will only\n// produce a wuffs_base__token for decimal numbers, not hexadecimal.\n// - It is not affected by i18n / l10n settings such as environment variables.\n//\n// The options argument can change these, but by default, it:\n// - Rejects " +
+ "underscores. With an explicit opt-in, \"__0D_1_002\" would\n// successfully parse as \"one thousand and two\". Underscores are still\n// rejected inside the optional 2-byte opening \"0d\" or \"0X\" that denotes\n// base-10 or base-16.\n// - Rejects unnecessary leading zeroes: \"00\" and \"0644\".\n//\n// For modular builds that divide the base module into sub-modules, using this\n// function requires the WUFFS_CONFIG__MODULE__BASE__INTCONV sub-module, not\n// just WUFFS_CONFIG__MODULE__BASE__CORE.\nWUFFS_BASE__MAYBE_STATIC wuffs_base__result_u64 //\nwuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options);\n\n" +
"" +
"// --------\n\n#define WUFFS_BASE__I64__BYTE_LENGTH__MAX_INCL 20\n#define WUFFS_BASE__U64__BYTE_LENGTH__MAX_INCL 21\n\n// wuffs_base__render_number_f64 writes the decimal encoding of x to dst and\n// returns the number of bytes written. If dst is shorter than the entire\n// encoding, it returns 0 (and no bytes are written).\n//\n// For those familiar with C's printf or Go's fmt.Printf functions:\n// - \"%e\" means the WUFFS_BASE__RENDER_NUMBER_FXX__EXPONENT_PRESENT option.\n// - \"%f\" means the WUFFS_BASE__RENDER_NUMBER_FXX__EXPONENT_ABSENT option.\n// - \"%g\" means neither or both bits are set.\n//\n// The precision argument controls the number of digits rendered, excluding the\n// exponent (the \"e+05\" in \"1.23e+05\"):\n// - for \"%e\" and \"%f\" it is the number of digits after the decimal separator,\n// - for \"%g\" it is the number of significant digits (and trailing zeroes are\n// removed).\n//\n// A precision of 6 gives similar output to printf's defaults.\n//\n// A precision greater than 4095 is equivalent to 4095.\n//\n// The " +
"precision argument is ignored when the\n// WUFFS_BASE__RENDER_NUMBER_FXX__JUST_ENOUGH_PRECISION option is set. This is\n// similar to Go's strconv.FormatFloat with a negative (i.e. non-sensical)\n// precision, but there is no corresponding feature in C's printf.\n//\n// Extreme values of x will be rendered as \"NaN\", \"Inf\" (or \"+Inf\" if the\n// WUFFS_BASE__RENDER_NUMBER_XXX__LEADING_PLUS_SIGN option is set) or \"-Inf\".\n//\n// For modular builds that divide the base module into sub-modules, using this\n// function requires the WUFFS_CONFIG__MODULE__BASE__FLOATCONV sub-module, not\n// just WUFFS_CONFIG__MODULE__BASE__CORE.\nWUFFS_BASE__MAYBE_STATIC size_t //\nwuffs_base__render_number_f64(wuffs_base__slice_u8 dst,\n double x,\n uint32_t precision,\n uint32_t options);\n\n// wuffs_base__render_number_i64 writes the decimal encoding of x to dst and\n// returns the number of bytes written. If dst is shorter than the entire\n// encoding, it returns" +
diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c
index a962567..cfa53e5 100644
--- a/release/c/wuffs-unsupported-snapshot.c
+++ b/release/c/wuffs-unsupported-snapshot.c
@@ -4015,44 +4015,6 @@
// ---------------- IEEE 754 Floating Point
-// wuffs_base__parse_number_f64 parses the floating point number in s. For
-// example, if s contains the bytes "1.5" then it will return the double 1.5.
-//
-// It returns an error if s does not contain a floating point number.
-//
-// It does not necessarily return an error if the conversion is lossy, e.g. if
-// s is "0.3", which double-precision floating point cannot represent exactly.
-//
-// Similarly, the returned value may be infinite (and no error returned) even
-// if s was not "inf", when the input is nominally finite but sufficiently
-// larger than DBL_MAX, about 1.8e+308.
-//
-// It is similar to the C standard library's strtod function, but:
-// - Errors are returned in-band (in a result type), not out-of-band (errno).
-// - It takes a slice (a pointer and length), not a NUL-terminated C string.
-// - It does not take an optional endptr argument. It does not allow a partial
-// parse: it returns an error unless all of s is consumed.
-// - It does not allow whitespace, leading or otherwise.
-// - It does not allow hexadecimal floating point numbers.
-// - It is not affected by i18n / l10n settings such as environment variables.
-//
-// The options argument can change these, but by default, it:
-// - Allows "inf", "+Infinity" and "-NAN", case insensitive. Similarly,
-// without an explicit opt-out, it would successfully parse "1e999" as
-// infinity, even though it overflows double-precision floating point.
-// - Rejects underscores. With an explicit opt-in, "_3.141_592" would
-// successfully parse as an approximation to π.
-// - Rejects unnecessary leading zeroes: "00", "0644" and "00.7".
-// - Uses a dot '1.5' instead of a comma '1,5' for the decimal separator.
-//
-// For modular builds that divide the base module into sub-modules, using this
-// function requires the WUFFS_CONFIG__MODULE__BASE__FLOATCONV sub-module, not
-// just WUFFS_CONFIG__MODULE__BASE__CORE.
-WUFFS_BASE__MAYBE_STATIC wuffs_base__result_f64 //
-wuffs_base__parse_number_f64(wuffs_base__slice_u8 s, uint32_t options);
-
-// --------
-
// wuffs_base__ieee_754_bit_representation__etc converts between a double
// precision numerical value and its IEEE 754 representations:
// - 16-bit: 1 sign bit, 5 exponent bits, 10 explicit significand bits.
@@ -4145,7 +4107,43 @@
return f;
}
-// ---------------- Integer
+// ---------------- Parsing and Rendering Numbers
+
+// wuffs_base__parse_number_f64 parses the floating point number in s. For
+// example, if s contains the bytes "1.5" then it will return the double 1.5.
+//
+// It returns an error if s does not contain a floating point number.
+//
+// It does not necessarily return an error if the conversion is lossy, e.g. if
+// s is "0.3", which double-precision floating point cannot represent exactly.
+//
+// Similarly, the returned value may be infinite (and no error returned) even
+// if s was not "inf", when the input is nominally finite but sufficiently
+// larger than DBL_MAX, about 1.8e+308.
+//
+// It is similar to the C standard library's strtod function, but:
+// - Errors are returned in-band (in a result type), not out-of-band (errno).
+// - It takes a slice (a pointer and length), not a NUL-terminated C string.
+// - It does not take an optional endptr argument. It does not allow a partial
+// parse: it returns an error unless all of s is consumed.
+// - It does not allow whitespace, leading or otherwise.
+// - It does not allow hexadecimal floating point numbers.
+// - It is not affected by i18n / l10n settings such as environment variables.
+//
+// The options argument can change these, but by default, it:
+// - Allows "inf", "+Infinity" and "-NAN", case insensitive. Similarly,
+// without an explicit opt-out, it would successfully parse "1e999" as
+// infinity, even though it overflows double-precision floating point.
+// - Rejects underscores. With an explicit opt-in, "_3.141_592" would
+// successfully parse as an approximation to π.
+// - Rejects unnecessary leading zeroes: "00", "0644" and "00.7".
+// - Uses a dot '1.5' instead of a comma '1,5' for the decimal separator.
+//
+// For modular builds that divide the base module into sub-modules, using this
+// function requires the WUFFS_CONFIG__MODULE__BASE__FLOATCONV sub-module, not
+// just WUFFS_CONFIG__MODULE__BASE__CORE.
+WUFFS_BASE__MAYBE_STATIC wuffs_base__result_f64 //
+wuffs_base__parse_number_f64(wuffs_base__slice_u8 s, uint32_t options);
// wuffs_base__parse_number_i64 parses the ASCII integer in s. For example, if
// s contains the bytes "-123" then it will return the int64_t -123.