Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node 12.11.0: Scientific & Engineering notation NumberFormat bug #29734

Closed
DerekNonGeneric opened this issue Sep 27, 2019 · 5 comments
Closed
Labels
i18n-api Issues and PRs related to the i18n implementation.

Comments

@DerekNonGeneric
Copy link
Contributor

DerekNonGeneric commented Sep 27, 2019

  • Version: v12.11.0

  • Platforms:

    • Windows Server 2019 x64

      v10.0.17763.737
      
    • Debian via Windows Subsystem for Linux (WSL)

      Linux WIN-RB75RCSBNFD 4.4.0-17763-Microsoft #379-Microsoft Wed Mar 06 19:16:00 PST 2019 x86_64 GNU/Linux
      
  • Subsystem: icu

    {
      node: '12.11.0',
      v8: '7.7.299.11-node.12',
      uv: '1.32.0',
      zlib: '1.2.11',
      brotli: '1.0.7',
      ares: '1.15.0',
      modules: '72',
      nghttp2: '1.39.2',
      napi: '5',
      llhttp: '1.1.4',
      http_parser: '2.8.0',
      openssl: '1.1.1c',
      cldr: '35.1',
      icu: '64.2',
      tz: '2019a',
      unicode: '12.1'
    }
    

This was tested in the REPL with PowerShell on Windows and Bash on WSL Debian. They both have the same problem.

IN

const formatter = Intl.NumberFormat('en', {style: 'unit', unit: 'meter-per-second', notation: 'scientific'});

or

const formatter = Intl.NumberFormat('en', {style: 'unit', unit: 'meter-per-second', notation: 'engineering'});

and

formatter.format(299792458);

OUT

TypeError: Internal error. Icu error.

engineering

This is the same code used in the Intl.NumberFormat V8 docs.

This bug does not only arise when specifying notation as compact notation works without error.

compact

@targos
Copy link
Member

targos commented Sep 27, 2019

I don't know if throwing an error is spec-compliant, but I figured that the "unit" option requires full-icu to work properly.

/cc @nodejs/intl @nodejs/v8

@srl295
Copy link
Member

srl295 commented Sep 27, 2019

it may be that the unit data is omitted from the 'small icu' default set and it should now be included now that units are present.

@targos targos added the i18n-api Issues and PRs related to the i18n implementation. label Sep 27, 2019
@targos
Copy link
Member

targos commented Sep 27, 2019

@srl295 should I try to change this line?

"unit": "none"

@srl295
Copy link
Member

srl295 commented Sep 27, 2019

@srl295 should I try to change this line?

"unit": "none"

Yes. And then rerun configure with --with-intl=small-icu --download=all --with-icu-source=https://github.com/unicode-org/icu/releases/download/release-64-2/icu4c-64_2-src.tgz to reapply the adjusted trimming.

targos added a commit to targos/node that referenced this issue Sep 27, 2019
The data are needed for new Intl.NumberFormat options added by V8.

Fixes: nodejs#29734
@DerekNonGeneric
Copy link
Contributor Author

DerekNonGeneric commented Sep 27, 2019

I just ran these tests on the official amd64/node:current-buster Docker image after updating to use v12.11.0 and can confirm that this bug is widespread and not exclusive to Windows.

@DerekNonGeneric DerekNonGeneric changed the title node 12.11.0: Scientific & Engineering notation NumberFormat bug on Windows node 12.11.0: Scientific & Engineering notation NumberFormat bug Sep 27, 2019
@Trott Trott closed this as completed in 634a9a9 Sep 30, 2019
targos added a commit that referenced this issue Oct 1, 2019
The data are needed for new Intl.NumberFormat options added by V8.

Fixes: #29734

PR-URL: #29735
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Steven R Loomis <srloomis@us.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n-api Issues and PRs related to the i18n implementation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants