Skip to content

Math.parseDouble accepts string representing hexadecimal numbers #1929

Closed
@DartBot

Description

@DartBot

This issue was originally filed by ms...@unipro.ru


What steps will reproduce the problem?
Run the following test:
main() {
  var d = Math.parseDouble('0xa');
  print(d);
}

What is the expected output? What do you see instead?
Since doubles don't have a hex representation, BadNumberFormatException is expected.
Actual: test runs without errors. DartVM output: 10.0. Frog output: 0.

What version of the product are you using? On what operating system?
DartVM, Frog r4779. OS Ubuntu 10.04.

Please provide any additional information below.
Test in co19: LibTest/core/Math/parseDouble_A02_t01.dart

Activity

floitschG

floitschG commented on Mar 5, 2012

@floitschG
Contributor

I think this is my fault. I just copy/pasted most of the parseInt tests into parseDouble but forgot to remove the hexadecimal tests.

Imho we should disallow hexadecimal parseDouble.
On the other hand we should add a parseNum function. Opening another issue for that.


Added Area-Library, Triaged labels.

DartBot

DartBot commented on Mar 7, 2012

@DartBot
Author

This comment was originally written by @mhausner


Still unresolved.

co19 test LibTest/core/Math/parseDouble_A02_t01.dart

lrhn

lrhn commented on Aug 19, 2013

@lrhn
Member

Added Fixed label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @lrhn@floitschG@DartBot

        Issue actions

          Math.parseDouble accepts string representing hexadecimal numbers · Issue #1929 · dart-lang/sdk