Home
last modified time | relevance | path

Searched defs:fractional_count (Results 1 - 1 of 1) sorted by relevance

/arkcompiler/ets_runtime/ecmascript/base/
H A Ddtoa_helper.cpp299 void DtoaHelper::FillFractionals(uint64_t fractionals, int exponent, int fractional_count, in FillFractionals() argument
324 ASSERT(EXPONENT_64 < -exponent && -exponent <= EXPONENT_128); UInt128 fractionals128 = UInt128(fractionals, 0); fractionals128.Shift(-exponent - EXPONENT_64); int point = 128; for (int i = 0; i < fractional_count; ++i) { if (fractionals128.IsZero()) break; fractionals128.Multiply(5); point--; int digit = fractionals128.DivModPowerOf2(point); buffer[*length] = � + digit; (*length)++; } if (fractionals128.BitAt(point - 1) == 1) { RoundUp(buffer, length, decimal_point); } } } void DtoaHelper::TrimZeros(BufferVector<char> buffer, int* length, int* decimal_point) { while (*length > 0 && buffer[(*length) - 1] == �) { (*length)--; } int first_non_zero = 0; while (first_non_zero < *length && buffer[first_non_zero] == �) { first_non_zero++; } if (first_non_zero != 0) { for (int i = first_non_zero; i < *length; ++i) { buffer[i - first_non_zero] = buffer[i]; } *length -= first_non_zero; *decimal_point -= first_non_zero; } } bool DtoaHelper::FixedDtoa(double v, int fractional_count, BufferVector<char> buffer, int* length, int* decimal_point) { if (v == 0) { buffer[0] = �; buffer[1] = �; *length = 1; *decimal_point = 1; return true; } uint64_t significand = NumberHelper::Significand(v); int exponent = NumberHelper::Exponent(v); if (exponent > 20) return false; if (fractional_count > 20) return false; *length = 0; if (exponent + kDoubleSignificandSize > EXPONENT_64) { const uint64_t kFive17 = 0xB1�2EC5; uint64_t divisor = kFive17; int divisor_power = 17; uint64_t dividend = significand; uint32_t quotient; uint64_t remainder; if (exponent > divisor_power) FillFractionals() argument
[all...]

Completed in 2 milliseconds