Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 // Halfway cases are rounded towards +/-Infinity (away from 0). The call | 65 // Halfway cases are rounded towards +/-Infinity (away from 0). The call |
| 66 // toFixed(0.15, 2) thus returns buffer="2", point=0. | 66 // toFixed(0.15, 2) thus returns buffer="2", point=0. |
| 67 // The returned buffer may contain digits that would be truncated from the | 67 // The returned buffer may contain digits that would be truncated from the |
| 68 // shortest representation of the input. | 68 // shortest representation of the input. |
| 69 // - PRECISION: produces 'requested_digits' where the first digit is not '0'. | 69 // - PRECISION: produces 'requested_digits' where the first digit is not '0'. |
| 70 // Even though the length of produced digits usually equals | 70 // Even though the length of produced digits usually equals |
| 71 // 'requested_digits', the function is allowed to return fewer digits, in | 71 // 'requested_digits', the function is allowed to return fewer digits, in |
| 72 // which case the caller has to fill the missing digits with '0's. | 72 // which case the caller has to fill the missing digits with '0's. |
| 73 // Halfway cases are again rounded away from 0. | 73 // Halfway cases are again rounded away from 0. |
| 74 // 'DoubleToAscii' expects the given buffer to be big enough to hold all digits | 74 // 'DoubleToAscii' expects the given buffer to be big enough to hold all digits |
| 75 // and a terminating null-character. | 75 // and a terminating null-character. In SHORTEST-mode it expects a buffer of |
| 76 bool DoubleToAscii(double v, DtoaMode mode, int requested_digits, | 76 // at least kBase10MaximalLength + 1 and otherwise the requested_digits |
|
William Hesse
2010/11/15 15:48:30
+ 1. Otherwise, the size of the output is limited
Florian Loitsch
2010/11/16 14:32:06
Done.
| |
| 77 // parameter (+ 1) limits the size of the output. | |
| 78 void DoubleToAscii(double v, DtoaMode mode, int requested_digits, | |
| 77 Vector<char> buffer, int* sign, int* length, int* point); | 79 Vector<char> buffer, int* sign, int* length, int* point); |
| 78 | 80 |
| 79 } } // namespace v8::internal | 81 } } // namespace v8::internal |
| 80 | 82 |
| 81 #endif // V8_DTOA_H_ | 83 #endif // V8_DTOA_H_ |
| OLD | NEW |