| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_FIXED_DTOA_H_ | 28 #ifndef V8_FIXED_DTOA_H_ |
| 29 #define V8_FIXED_DTOA_H_ | 29 #define V8_FIXED_DTOA_H_ |
| 30 | 30 |
| 31 namespace v8 { | 31 namespace v8 { |
| 32 namespace internal { | 32 namespace internal { |
| 33 | 33 |
| 34 template <typename T> class Vector; |
| 35 |
| 34 // Produces digits necessary to print a given number with | 36 // Produces digits necessary to print a given number with |
| 35 // 'fractional_count' digits after the decimal point. | 37 // 'fractional_count' digits after the decimal point. |
| 36 // The buffer must be big enough to hold the result plus one terminating null | 38 // The buffer must be big enough to hold the result plus one terminating null |
| 37 // character. | 39 // character. |
| 38 // | 40 // |
| 39 // The produced digits might be too short in which case the caller has to fill | 41 // The produced digits might be too short in which case the caller has to fill |
| 40 // the gaps with '0's. | 42 // the gaps with '0's. |
| 41 // Example: FastFixedDtoa(0.001, 5, ...) is allowed to return buffer = "1", and | 43 // Example: FastFixedDtoa(0.001, 5, ...) is allowed to return buffer = "1", and |
| 42 // decimal_point = -2. | 44 // decimal_point = -2. |
| 43 // Halfway cases are rounded towards +/-Infinity (away from 0). The call | 45 // Halfway cases are rounded towards +/-Infinity (away from 0). The call |
| 44 // FastFixedDtoa(0.15, 2, ...) thus returns buffer = "2", decimal_point = 0. | 46 // FastFixedDtoa(0.15, 2, ...) thus returns buffer = "2", decimal_point = 0. |
| 45 // The returned buffer may contain digits that would be truncated from the | 47 // The returned buffer may contain digits that would be truncated from the |
| 46 // shortest representation of the input. | 48 // shortest representation of the input. |
| 47 // | 49 // |
| 48 // This method only works for some parameters. If it can't handle the input it | 50 // This method only works for some parameters. If it can't handle the input it |
| 49 // returns false. The output is null-terminated when the function succeeds. | 51 // returns false. The output is null-terminated when the function succeeds. |
| 50 bool FastFixedDtoa(double v, int fractional_count, | 52 bool FastFixedDtoa(double v, int fractional_count, |
| 51 Vector<char> buffer, int* length, int* decimal_point); | 53 Vector<char> buffer, int* length, int* decimal_point); |
| 52 | 54 |
| 53 } } // namespace v8::internal | 55 } } // namespace v8::internal |
| 54 | 56 |
| 55 #endif // V8_FIXED_DTOA_H_ | 57 #endif // V8_FIXED_DTOA_H_ |
| OLD | NEW |