V8 Project
fast-dtoa.h
Go to the documentation of this file.
1 // Copyright 2011 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_FAST_DTOA_H_
6 #define V8_FAST_DTOA_H_
7 
8 namespace v8 {
9 namespace internal {
10 
12  // Computes the shortest representation of the given input. The returned
13  // result will be the most accurate number of this length. Longer
14  // representations might be more accurate.
16  // Computes a representation where the precision (number of digits) is
17  // given as input. The precision is independent of the decimal point.
19 };
20 
21 // FastDtoa will produce at most kFastDtoaMaximalLength digits. This does not
22 // include the terminating '\0' character.
23 const int kFastDtoaMaximalLength = 17;
24 
25 // Provides a decimal representation of v.
26 // The result should be interpreted as buffer * 10^(point - length).
27 //
28 // Precondition:
29 // * v must be a strictly positive finite double.
30 //
31 // Returns true if it succeeds, otherwise the result can not be trusted.
32 // There will be *length digits inside the buffer followed by a null terminator.
33 // If the function returns true and mode equals
34 // - FAST_DTOA_SHORTEST, then
35 // the parameter requested_digits is ignored.
36 // The result satisfies
37 // v == (double) (buffer * 10^(point - length)).
38 // The digits in the buffer are the shortest representation possible. E.g.
39 // if 0.099999999999 and 0.1 represent the same double then "1" is returned
40 // with point = 0.
41 // The last digit will be closest to the actual v. That is, even if several
42 // digits might correctly yield 'v' when read again, the buffer will contain
43 // the one closest to v.
44 // - FAST_DTOA_PRECISION, then
45 // the buffer contains requested_digits digits.
46 // the difference v - (buffer * 10^(point-length)) is closest to zero for
47 // all possible representations of requested_digits digits.
48 // If there are two values that are equally close, then FastDtoa returns
49 // false.
50 // For both modes the buffer must be large enough to hold the result.
51 bool FastDtoa(double d,
53  int requested_digits,
54  Vector<char> buffer,
55  int* length,
56  int* decimal_point);
57 
58 } } // namespace v8::internal
59 
60 #endif // V8_FAST_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
@ FAST_DTOA_SHORTEST
Definition: fast-dtoa.h:15
@ FAST_DTOA_PRECISION
Definition: fast-dtoa.h:18
const int kFastDtoaMaximalLength
Definition: fast-dtoa.h:23
bool FastDtoa(double v, FastDtoaMode mode, int requested_digits, Vector< char > buffer, int *length, int *decimal_point)
Definition: fast-dtoa.cc:686
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20