V8 Project
bignum-dtoa.h
Go to the documentation of this file.
1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_BIGNUM_DTOA_H_
6 #define V8_BIGNUM_DTOA_H_
7 
8 namespace v8 {
9 namespace internal {
10 
12  // Return the shortest correct representation.
13  // For example the output of 0.299999999999999988897 is (the less accurate but
14  // correct) 0.3.
16  // Return a fixed number of digits after the decimal point.
17  // For instance fixed(0.1, 4) becomes 0.1000
18  // If the input number is big, the output will be big.
20  // Return a fixed number of digits, no matter what the exponent is.
22 };
23 
24 // Converts the given double 'v' to ASCII.
25 // The result should be interpreted as buffer * 10^(point-length).
26 // The buffer will be null-terminated.
27 //
28 // The input v must be > 0 and different from NaN, and Infinity.
29 //
30 // The output depends on the given mode:
31 // - SHORTEST: produce the least amount of digits for which the internal
32 // identity requirement is still satisfied. If the digits are printed
33 // (together with the correct exponent) then reading this number will give
34 // 'v' again. The buffer will choose the representation that is closest to
35 // 'v'. If there are two at the same distance, than the number is round up.
36 // In this mode the 'requested_digits' parameter is ignored.
37 // - FIXED: produces digits necessary to print a given number with
38 // 'requested_digits' digits after the decimal point. The produced digits
39 // might be too short in which case the caller has to fill the gaps with '0's.
40 // Example: toFixed(0.001, 5) is allowed to return buffer="1", point=-2.
41 // Halfway cases are rounded up. The call toFixed(0.15, 2) thus returns
42 // buffer="2", point=0.
43 // Note: the length of the returned buffer has no meaning wrt the significance
44 // of its digits. That is, just because it contains '0's does not mean that
45 // any other digit would not satisfy the internal identity requirement.
46 // - PRECISION: produces 'requested_digits' where the first digit is not '0'.
47 // Even though the length of produced digits usually equals
48 // 'requested_digits', the function is allowed to return fewer digits, in
49 // which case the caller has to fill the missing digits with '0's.
50 // Halfway cases are again rounded up.
51 // 'BignumDtoa' expects the given buffer to be big enough to hold all digits
52 // and a terminating null-character.
53 void BignumDtoa(double v, BignumDtoaMode mode, int requested_digits,
54  Vector<char> buffer, int* length, int* point);
55 
56 } } // namespace v8::internal
57 
58 #endif // V8_BIGNUM_DTOA_H_
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
@ BIGNUM_DTOA_SHORTEST
Definition: bignum-dtoa.h:15
@ BIGNUM_DTOA_PRECISION
Definition: bignum-dtoa.h:21
void BignumDtoa(double v, BignumDtoaMode mode, int requested_digits, Vector< char > buffer, int *length, int *decimal_point)
Definition: bignum-dtoa.cc:69
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20