1 /**
2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include <cstdlib>
17 #include "dtoa_helper.h"
18 #include "ets_intrinsics_helpers.h"
19 #include "include/mem/panda_string.h"
20 #include "types/ets_field.h"
21 #include "types/ets_string.h"
22
23 namespace ark::ets::intrinsics::helpers {
24
25 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
26 #define RETURN_IF_CONVERSION_END(p, end, result) \
27 if ((p) == (end)) { \
28 return (result); \
29 }
30
31 namespace parse_helpers {
32
33 template <typename ResultType>
34 struct ParseResult {
35 ResultType value;
36 uint8_t *pointerPosition = nullptr;
37 bool isSuccess = false;
38 };
39
ParseExponent(const uint8_t * start,const uint8_t * end,const uint8_t radix,const uint32_t flags)40 ParseResult<int32_t> ParseExponent(const uint8_t *start, const uint8_t *end, const uint8_t radix, const uint32_t flags)
41 {
42 constexpr int32_t MAX_EXPONENT = INT32_MAX / 2;
43 auto p = const_cast<uint8_t *>(start);
44 if (radix == 0) {
45 return {0, p, false};
46 }
47
48 char exponentSign = '+';
49 int32_t additionalExponent = 0;
50 bool undefinedExponent = false;
51 ++p;
52 if (p == end) {
53 undefinedExponent = true;
54 }
55
56 if (!undefinedExponent && (*p == '+' || *p == '-')) {
57 exponentSign = static_cast<char>(*p);
58 ++p;
59 if (p == end) {
60 undefinedExponent = true;
61 }
62 }
63 if (!undefinedExponent) {
64 uint8_t digit;
65 while ((digit = ToDigit(*p)) < radix) {
66 if (additionalExponent > MAX_EXPONENT / radix) {
67 additionalExponent = MAX_EXPONENT;
68 } else {
69 additionalExponent = additionalExponent * static_cast<int32_t>(radix) + static_cast<int32_t>(digit);
70 }
71 if (++p == end) {
72 break;
73 }
74 }
75 } else if ((flags & flags::ERROR_IN_EXPONENT_IS_NAN) != 0) {
76 return {0, p, false};
77 }
78 if (exponentSign == '-') {
79 return {-additionalExponent, p, true};
80 }
81 return {additionalExponent, p, true};
82 }
83
84 } // namespace parse_helpers
85
86 // CC-OFFNXT(G.FUN.01-CPP,huge_cyclomatic_complexity[C++],huge_method[C++]) solid logic
87 // CC-OFFNXT(huge_cca_cyclomatic_complexity[C++]) solid logic
StringToDouble(const uint8_t * start,const uint8_t * end,uint8_t radix,uint32_t flags)88 double StringToDouble(const uint8_t *start, const uint8_t *end, uint8_t radix, uint32_t flags)
89 {
90 // 1. skip space and line terminal
91 if (IsEmptyString(start, end)) {
92 if ((flags & flags::EMPTY_IS_ZERO) != 0) {
93 return 0.0;
94 }
95 return NAN_VALUE;
96 }
97
98 radix = 0;
99 auto p = const_cast<uint8_t *>(start);
100
101 GotoNonspace(&p, end);
102
103 // 2. get number sign
104 Sign sign = Sign::NONE;
105 if (*p == '+') {
106 RETURN_IF_CONVERSION_END(++p, end, NAN_VALUE);
107 sign = Sign::POS;
108 } else if (*p == '-') {
109 RETURN_IF_CONVERSION_END(++p, end, NAN_VALUE);
110 sign = Sign::NEG;
111 }
112 bool ignoreTrailing = (flags & flags::IGNORE_TRAILING) != 0;
113
114 // 3. judge Infinity
115 static const char INF[] = "Infinity"; // NOLINT(modernize-avoid-c-arrays)
116 if (*p == INF[0]) {
117 // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
118 for (const char *i = &INF[1]; *i != '\0'; ++i) {
119 if (++p == end || *p != *i) {
120 return NAN_VALUE;
121 }
122 }
123 ++p;
124 if (!ignoreTrailing && GotoNonspace(&p, end)) {
125 return NAN_VALUE;
126 }
127 return sign == Sign::NEG ? -POSITIVE_INFINITY : POSITIVE_INFINITY;
128 }
129
130 // 4. get number radix
131 bool leadingZero = false;
132 bool prefixRadix = false;
133 if (*p == '0' && radix == 0) {
134 RETURN_IF_CONVERSION_END(++p, end, SignedZero(sign));
135 if (*p == 'x' || *p == 'X') {
136 if ((flags & flags::ALLOW_HEX) == 0) {
137 return ignoreTrailing ? SignedZero(sign) : NAN_VALUE;
138 }
139 RETURN_IF_CONVERSION_END(++p, end, NAN_VALUE);
140 if (sign != Sign::NONE) {
141 return NAN_VALUE;
142 }
143 prefixRadix = true;
144 radix = HEXADECIMAL;
145 } else if (*p == 'o' || *p == 'O') {
146 if ((flags & flags::ALLOW_OCTAL) == 0) {
147 return ignoreTrailing ? SignedZero(sign) : NAN_VALUE;
148 }
149 RETURN_IF_CONVERSION_END(++p, end, NAN_VALUE);
150 if (sign != Sign::NONE) {
151 return NAN_VALUE;
152 }
153 prefixRadix = true;
154 radix = OCTAL;
155 } else if (*p == 'b' || *p == 'B') {
156 if ((flags & flags::ALLOW_BINARY) == 0) {
157 return ignoreTrailing ? SignedZero(sign) : NAN_VALUE;
158 }
159 RETURN_IF_CONVERSION_END(++p, end, NAN_VALUE);
160 if (sign != Sign::NONE) {
161 return NAN_VALUE;
162 }
163 prefixRadix = true;
164 radix = BINARY;
165 } else {
166 leadingZero = true;
167 }
168 }
169
170 if (radix == 0) {
171 radix = DECIMAL;
172 }
173 auto pStart = p;
174 // 5. skip leading '0'
175 while (*p == '0') {
176 RETURN_IF_CONVERSION_END(++p, end, SignedZero(sign));
177 leadingZero = true;
178 }
179 // 6. parse to number
180 uint64_t intNumber = 0;
181 uint64_t numberMax = (UINT64_MAX - (radix - 1)) / radix;
182 int digits = 0;
183 int exponent = 0;
184 do {
185 uint8_t c = ToDigit(*p);
186 if (c >= radix) {
187 if (!prefixRadix || ignoreTrailing || (pStart != p && !GotoNonspace(&p, end))) {
188 break;
189 }
190 // "0b" "0x1.2" "0b1e2" ...
191 return NAN_VALUE;
192 }
193 ++digits;
194 if (intNumber < numberMax) {
195 intNumber = intNumber * radix + c;
196 } else {
197 ++exponent;
198 }
199 } while (++p != end);
200
201 auto number = static_cast<double>(intNumber);
202 if (sign == Sign::NEG) {
203 if (number == 0) {
204 number = -0.0;
205 } else {
206 number = -number;
207 }
208 }
209
210 // 7. deal with other radix except DECIMAL
211 if (p == end || radix != DECIMAL) {
212 if ((digits == 0 && !leadingZero) || (p != end && !ignoreTrailing && GotoNonspace(&p, end))) {
213 // no digits there, like "0x", "0xh", or error trailing of "0x3q"
214 return NAN_VALUE;
215 }
216 return number * std::pow(radix, exponent);
217 }
218
219 // 8. parse '.'
220 if (*p == '.') {
221 RETURN_IF_CONVERSION_END(++p, end, (digits > 0) ? (number * std::pow(radix, exponent)) : NAN_VALUE);
222 while (ToDigit(*p) < radix) {
223 --exponent;
224 ++digits;
225 if (++p == end) {
226 break;
227 }
228 }
229 }
230 if (digits == 0 && !leadingZero) {
231 // no digits there, like ".", "sss", or ".e1"
232 return NAN_VALUE;
233 }
234 auto pEnd = p;
235
236 // 9. parse 'e/E' with '+/-'
237 if (radix == DECIMAL && (p != end && (*p == 'e' || *p == 'E'))) {
238 auto parseExponentResult = parse_helpers::ParseExponent(p, end, radix, flags);
239 if (!parseExponentResult.isSuccess) {
240 return NAN_VALUE;
241 }
242 p = parseExponentResult.pointerPosition;
243 exponent += parseExponentResult.value;
244 }
245 if (!ignoreTrailing && GotoNonspace(&p, end)) {
246 return NAN_VALUE;
247 }
248
249 // 10. build StringNumericLiteral string
250 PandaString buffer;
251 if (sign == Sign::NEG) {
252 buffer += "-";
253 }
254 for (uint8_t *i = pStart; i < pEnd; ++i) { // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
255 if (*i != static_cast<uint8_t>('.')) {
256 buffer += *i;
257 }
258 }
259
260 // 11. convert none-prefix radix string
261 return Strtod(buffer.c_str(), exponent, radix);
262 }
263
264 // CC-OFFNXT(G.FUN.01-CPP,huge_cyclomatic_complexity[C++],huge_method[C++]) solid logic
265 // CC-OFFNXT(huge_cca_cyclomatic_complexity[C++]) solid logic
StringToDoubleWithRadix(const uint8_t * start,const uint8_t * end,int radix)266 double StringToDoubleWithRadix(const uint8_t *start, const uint8_t *end, int radix)
267 {
268 auto p = const_cast<uint8_t *>(start);
269 // 1. skip space and line terminal
270 if (!GotoNonspace(&p, end)) {
271 return NAN_VALUE;
272 }
273
274 // 2. sign bit
275 bool negative = false;
276 if (*p == '-') {
277 negative = true;
278 RETURN_IF_CONVERSION_END(++p, end, NAN_VALUE);
279 } else if (*p == '+') {
280 RETURN_IF_CONVERSION_END(++p, end, NAN_VALUE);
281 }
282 // 3. 0x or 0X
283 bool stripPrefix = true;
284 // 4. If R != 0, then
285 // a. If R < 2 or R > 36, return NaN.
286 // b. If R != 16, let stripPrefix be false.
287 if (radix != 0) {
288 if (radix < MIN_RADIX || radix > MAX_RADIX) {
289 return NAN_VALUE;
290 }
291 if (radix != HEXADECIMAL) {
292 stripPrefix = false;
293 }
294 } else {
295 radix = DECIMAL;
296 }
297 int size = 0;
298 if (stripPrefix) {
299 if (*p == '0') {
300 size++;
301 if (++p != end && (*p == 'x' || *p == 'X')) {
302 RETURN_IF_CONVERSION_END(++p, end, NAN_VALUE);
303 radix = HEXADECIMAL;
304 }
305 }
306 }
307
308 double result = 0;
309 bool isDone = false;
310 do {
311 double part = 0;
312 uint32_t multiplier = 1;
313 for (; p != end; ++p) {
314 // The maximum value to ensure that uint32_t will not overflow
315 const uint32_t maxMultiper = 0xffffffffU / 36U;
316 uint32_t m = multiplier * static_cast<uint32_t>(radix);
317 if (m > maxMultiper) {
318 break;
319 }
320
321 int currentBit = static_cast<int>(ToDigit(*p));
322 if (currentBit >= radix) {
323 isDone = true;
324 break;
325 }
326 size++;
327 part = part * radix + currentBit;
328 multiplier = m;
329 }
330 result = result * multiplier + part;
331 if (isDone) {
332 break;
333 }
334 } while (p != end);
335
336 if (size == 0) {
337 return NAN_VALUE;
338 }
339
340 return negative ? -result : result;
341 }
342
DoubleToExponential(double number,int digit)343 EtsString *DoubleToExponential(double number, int digit)
344 {
345 PandaStringStream ss;
346 if (digit < 0) {
347 ss << std::setiosflags(std::ios::scientific) << std::setprecision(MAX_PRECISION) << number;
348 } else {
349 ss << std::setiosflags(std::ios::scientific) << std::setprecision(digit) << number;
350 }
351 PandaString result = ss.str();
352 size_t found = result.find_last_of('e');
353 if (found != PandaString::npos && found < result.size() - 2U && result[found + 2U] == '0') {
354 result.erase(found + 2U, 1); // 2:offset of e
355 }
356 if (digit < 0) {
357 size_t end = found;
358 while (--found > 0) {
359 if (result[found] != '0') {
360 break;
361 }
362 }
363 if (result[found] == '.') {
364 found--;
365 }
366 if (found < end - 1) {
367 result.erase(found + 1, end - found - 1);
368 }
369 }
370 return EtsString::CreateFromMUtf8(result.c_str());
371 }
372
DoubleToFixed(double number,int digit)373 EtsString *DoubleToFixed(double number, int digit)
374 {
375 PandaStringStream ss;
376 ss << std::setiosflags(std::ios::fixed) << std::setprecision(digit) << number;
377 return EtsString::CreateFromMUtf8(ss.str().c_str());
378 }
379
DoubleToPrecision(double number,int digit)380 EtsString *DoubleToPrecision(double number, int digit)
381 {
382 if (number == 0.0) {
383 return DoubleToFixed(number, digit - 1);
384 }
385 PandaStringStream ss;
386 double positiveNumber = number > 0 ? number : -number;
387 int logDigit = std::floor(log10(positiveNumber));
388 int radixDigit = digit - logDigit - 1;
389 const int maxExponentDigit = 6;
390 if ((logDigit >= 0 && radixDigit >= 0) || (logDigit < 0 && radixDigit <= maxExponentDigit)) {
391 return DoubleToFixed(number, std::abs(radixDigit));
392 }
393 return DoubleToExponential(number, digit - 1);
394 }
395
GetStdDoubleArgument(ObjectHeader * obj)396 double GetStdDoubleArgument(ObjectHeader *obj)
397 {
398 auto *cls = obj->ClassAddr<Class>();
399
400 // Assume std.core.Double has only one `double` field
401 ASSERT(cls->GetInstanceFields().size() == 1);
402
403 Field &fieldVal = cls->GetInstanceFields()[0];
404
405 ASSERT(fieldVal.GetTypeId() == panda_file::Type::TypeId::F64);
406
407 size_t offset = fieldVal.GetOffset();
408 return obj->GetFieldPrimitive<double>(offset);
409 }
410
411 // NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic)
412 template <typename FpType, std::enable_if_t<std::is_floating_point_v<FpType>, bool> = true>
GetBase(FpType d,int digits,int * decpt,Span<char> buf)413 void GetBase(FpType d, int digits, int *decpt, Span<char> buf)
414 {
415 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
416 auto ret = snprintf_s(buf.begin(), buf.size(), buf.size() - 1, "%.*e", digits - 1, d);
417 if (ret == -1) {
418 LOG(FATAL, ETS) << "snprintf_s failed";
419 UNREACHABLE();
420 }
421 char *end = buf.begin() + ret;
422 ASSERT(*end == 0);
423 const size_t positive = (digits > 1) ? 1 : 0;
424 char *ePos = buf.begin() + digits + positive;
425 ASSERT(*ePos == 'e');
426 char *signPos = ePos + 1;
427 char *from = signPos + 1;
428 // exponent
429 if (std::from_chars(from, end, *decpt).ec != std::errc()) {
430 UNREACHABLE();
431 }
432 if (*signPos == '-') {
433 *decpt *= -1;
434 }
435 ++*decpt;
436 }
437
438 constexpr bool USE_GET_BASE_FAST =
439 #ifdef __cpp_lib_to_chars
440 true;
441 #else
442 false;
443 #endif
444
445 template <typename FpType, std::enable_if_t<std::is_floating_point_v<FpType>, bool> = true>
GetBaseFast(FpType d,int * decpt,Span<char> buf)446 int GetBaseFast([[maybe_unused]] FpType d, int *decpt, Span<char> buf)
447 {
448 ASSERT(d >= 0);
449 char *end;
450 #ifdef __cpp_lib_to_chars
451 auto ret = std::to_chars(buf.begin(), buf.end(), d, std::chars_format::scientific);
452 if (ret.ec != std::errc()) {
453 LOG(FATAL, ETS) << "to_chars failed";
454 UNREACHABLE();
455 }
456 end = ret.ptr;
457 #else
458 UNREACHABLE();
459 #endif
460 *end = '\0';
461 // exponent
462 // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
463 auto from = std::find(buf.begin(), end, 'e');
464 auto digits = from - buf.begin();
465 if (digits > 1) {
466 digits--;
467 }
468 ASSERT(from != end);
469 if (std::from_chars(from + 2U, end, *decpt).ec != std::errc()) {
470 UNREACHABLE();
471 }
472 if (from[1] == '-') {
473 *decpt *= -1;
474 }
475 ++*decpt;
476 return digits;
477 }
478
479 template <typename FpType>
GetBaseBinarySearch(FpType d,int * decpt,Span<char> buf)480 int GetBaseBinarySearch(FpType d, int *decpt, Span<char> buf)
481 {
482 // find the minimum amount of digits
483 int minDigits = 1;
484 int maxDigits = std::is_same_v<FpType, double> ? DOUBLE_MAX_PRECISION : FLOAT_MAX_PRECISION;
485 int digits;
486
487 while (minDigits < maxDigits) {
488 digits = (minDigits + maxDigits) / 2_I;
489 GetBase(d, digits, decpt, buf);
490
491 bool same = StrToFp<FpType>(buf.begin(), nullptr) == d;
492 if (same) {
493 // no need to keep the trailing zeros
494 // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
495 while (digits >= 2_I && buf[digits] == '0') { // 2 means ignore the integer and point
496 digits--;
497 }
498 maxDigits = digits;
499 } else {
500 minDigits = digits + 1;
501 }
502 }
503 digits = maxDigits;
504 GetBase(d, digits, decpt, buf);
505 return digits;
506 }
507
508 template <typename FpType>
RecheckGetMinimumDigits(FpType d,Span<char> buf)509 [[maybe_unused]] static bool RecheckGetMinimumDigits(FpType d, Span<char> buf)
510 {
511 ASSERT(StrToFp<FpType>(buf.begin(), nullptr) == d);
512 std::string str(buf.begin());
513 auto pos = str.find('e');
514 std::copy(str.begin() + pos, str.end(), str.begin() + pos - 1);
515 str[str.size() - 1] = '\0';
516 return StrToFp<FpType>(str.data(), nullptr) != d;
517 }
518
519 // result is written starting with buf[1]
520 template <typename FpType>
GetMinimumDigits(FpType d,int * decpt,Span<char> buf)521 int GetMinimumDigits(FpType d, int *decpt, Span<char> buf)
522 {
523 if (std::is_same_v<FpType, double>) {
524 DtoaHelper helper(buf.begin() + 1);
525 helper.Dtoa(d);
526 *decpt = helper.GetPoint();
527 return helper.GetDigits();
528 }
529 int digits;
530 if constexpr (USE_GET_BASE_FAST) {
531 digits = GetBaseFast(d, decpt, buf);
532 } else {
533 digits = GetBaseBinarySearch(d, decpt, buf);
534 }
535 ASSERT(RecheckGetMinimumDigits(d, buf));
536 ASSERT(digits == 1 || buf[1] == '.');
537 buf[1] = buf[0];
538 return digits;
539 }
540
541 template <typename FpType>
SmallFpToString(FpType number,bool negative,char * buffer)542 char *SmallFpToString(FpType number, bool negative, char *buffer)
543 {
544 using SignedInt = typename ark::helpers::TypeHelperT<sizeof(FpType) * CHAR_BIT, true>;
545 if (negative) {
546 *(buffer++) = '-';
547 }
548 *(buffer++) = '0';
549 *(buffer++) = '.';
550 SignedInt power = TEN;
551 SignedInt s = 0;
552 int maxDigits = std::is_same_v<FpType, double> ? DOUBLE_MAX_PRECISION : FLOAT_MAX_PRECISION;
553 int digits = maxDigits;
554 for (int k = 1; k <= maxDigits; ++k) {
555 s = static_cast<SignedInt>(number * power);
556 if (k == maxDigits || s / static_cast<FpType>(power) == number) { // s * (10 ** -k)
557 digits = k;
558 break;
559 }
560 power *= TEN;
561 }
562 for (int k = digits - 1; k >= 0; k--) {
563 auto digit = s % TEN;
564 s /= TEN;
565 *(buffer + k) = '0' + digit;
566 }
567 return buffer + digits;
568 }
569
570 template <typename FpType>
FpToStringDecimalRadixMainCase(FpType number,bool negative,Span<char> buffer)571 Span<char> FpToStringDecimalRadixMainCase(FpType number, bool negative, Span<char> buffer)
572 {
573 auto bufferStart = buffer.begin() + 2U;
574 ASSERT(number > 0);
575 int n = 0;
576 int k = intrinsics::helpers::GetMinimumDigits(number, &n, buffer.SubSpan(1));
577 auto bufferEnd = bufferStart + k;
578
579 if (0 < n && n <= 21_I) { // NOLINT(readability-magic-numbers)
580 if (k <= n) {
581 // 6. If k ≤ n ≤ 21, return the String consisting of the code units of the k digits of the decimal
582 // representation of s (in order, with no leading zeroes), followed by n−k occurrences of the code unit
583 // 0x0030 (DIGIT ZERO).
584 std::fill_n(bufferEnd, n - k, '0');
585 bufferEnd += n - k;
586 } else {
587 // 7. If 0 < n ≤ 21, return the String consisting of the code units of the most significant n digits of the
588 // decimal representation of s, followed by the code unit 0x002E (FULL STOP), followed by the code units of
589 // the remaining k−n digits of the decimal representation of s.
590 auto fracStart = bufferStart + n;
591 if (memmove_s(fracStart + 1, buffer.end() - (fracStart + 1), fracStart, k - n) != EOK) {
592 UNREACHABLE();
593 }
594 *fracStart = '.';
595 bufferEnd++;
596 }
597 } else if (-6_I < n && n <= 0) { // NOLINT(readability-magic-numbers)
598 // 8. If −6 < n ≤ 0, return the String consisting of the code unit 0x0030 (DIGIT ZERO), followed by the code
599 // unit 0x002E (FULL STOP), followed by −n occurrences of the code unit 0x0030 (DIGIT ZERO), followed by the
600 // code units of the k digits of the decimal representation of s.
601 auto length = -n + 2U;
602 auto fracStart = bufferStart + length;
603 if (memmove_s(fracStart, buffer.end() - fracStart, bufferStart, k) != EOK) {
604 UNREACHABLE();
605 }
606 std::fill_n(bufferStart, length, '0');
607 bufferStart[1] = '.';
608 bufferEnd += length;
609 } else {
610 if (k == 1) {
611 // 9. Otherwise, if k = 1, return the String consisting of the code unit of the single digit of s
612 ASSERT(bufferEnd == bufferStart + 1);
613 } else {
614 *(bufferStart - 1) = *bufferStart;
615 *(bufferStart--) = '.';
616 }
617 // followed by code unit 0x0065 (LATIN SMALL LETTER E), followed by the code unit 0x002B (PLUS SIGN) or the code
618 // unit 0x002D (HYPHEN-MINUS) according to whether n−1 is positive or negative, followed by the code units of
619 // the decimal representation of the integer abs(n−1) (with no leading zeroes).
620 *(bufferEnd++) = 'e';
621 if (n >= 1) {
622 *(bufferEnd++) = '+';
623 }
624 bufferEnd = std::to_chars(bufferEnd, buffer.end(), n - 1).ptr;
625 }
626 if (negative) {
627 *--bufferStart = '-';
628 }
629 return {bufferStart, bufferEnd};
630 }
631 // NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic)
632
633 template char *SmallFpToString<double>(double number, bool negative, char *buffer);
634 template char *SmallFpToString<float>(float number, bool negative, char *buffer);
635
636 template Span<char> FpToStringDecimalRadixMainCase<double>(double number, bool negative, Span<char> buffer);
637 template Span<char> FpToStringDecimalRadixMainCase<float>(float number, bool negative, Span<char> buffer);
638
639 } // namespace ark::ets::intrinsics::helpers
640