diff options
Diffstat (limited to 'src/exact_value.cpp')
| -rw-r--r-- | src/exact_value.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/exact_value.cpp b/src/exact_value.cpp index ac3d6a23f..e84b5b794 100644 --- a/src/exact_value.cpp +++ b/src/exact_value.cpp @@ -117,6 +117,39 @@ f64 float_from_string(String string) { i++; } +#if 0 + if (len-i > 2 && + str[i] == '0' && + str[i+1] == 'h') { + i += 2; + u8 *text = string.text; + isize len = string.len; + if (has_prefix) { + text += 2; + len -= 2; + } + + u64 base = 16; + + u64 result = {0}; + for (isize i = 0; i < len; i++) { + Rune r = cast(Rune)text[i]; + if (r == '_') { + continue; + } + u64 v = bit128__digit_value(r); + if (v >= base) { + break; + } + result *= base; + result += v; + } + + + return *cast(f64 *)&result; + } +#endif + f64 value = 0.0; for (; i < len; i++) { Rune r = cast(Rune)str[i]; |