[Webkit-unassigned] [Bug 199163] toExponential, toFixed, and toPrecision should allow arguments up to 100

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Sep 23 15:29:31 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=199163

Ross Kirsling <ross.kirsling at sony.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ross.kirsling at sony.com

--- Comment #4 from Ross Kirsling <ross.kirsling at sony.com> ---
Comment on attachment 372768
  --> https://bugs.webkit.org/attachment.cgi?id=372768
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=372768&action=review

Ha, I just did a fix patch for this myself and then realized that there's already one here...
I suppose I'll just add comments to yours instead.

> JSTests/ChakraCore/test/Number/toString.js:-31
> +    writeLine("n.toFixed(90):  " + n.toFixed(90));
>      safeCall(function () { n.toFixed(-1); });
> -    safeCall(function () { n.toFixed(21); });

It's probably best not to modify a ChakraCore test (especially since these lines haven't changed upstream) -- let's just update the output.

> Source/JavaScriptCore/ChangeLog:8
> +        getIntegerArgumentInRange had quite a few arguments and wasn't easy to follow, so I inlined it in methods.

Seems slightly unnecessary but I agree that the result is easier to read. :)

> Source/WTF/wtf/dtoa.h:30
> -using NumberToStringBuffer = std::array<char, 96>;
> +using NumberToStringBuffer = std::array<char, 176>;

This can be just 123 (<21 digits> + decimal point + <100 digits> + '\0'). Only toFixed actually uses this many.

> Source/WTF/wtf/dtoa/double-conversion.h:42
> -  static const int kMaxFixedDigitsAfterPoint = 60;
> +  static const int kMaxFixedDigitsAfterPoint = 100;

This is the only line that *needs* to change, but it'd be nice to update the others to their correct values too, i.e.:

  static const int kMaxFixedDigitsBeforePoint = 21;
  static const int kMaxFixedDigitsAfterPoint = 100;

  static const int kMaxExponentialDigits = 100;

  static const int kMinPrecisionDigits = 1;
  static const int kMaxPrecisionDigits = 100;

(And accordingly, lines 208 and 209 of double-conversion.cc.)

...that said, given that this is taken from https://github.com/google/double-conversion, we also might want to minimize changes...hmm.

One way or another, I believe it's okay to ignore style errors for this file.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190923/7bdd0810/attachment-0001.html>


More information about the webkit-unassigned mailing list