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

fix(input-number): negative zero point error #6386

Closed
wants to merge 1 commit into from

Conversation

CCherry07
Copy link
Member

First of all, thank you for your contribution! 😄

New feature please send pull request to feature branch, and rest to master branch. Pull request will be merged after one of collaborators approve. Please makes sure that these form are filled before submitting your pull request, thank you!

[中文版模板 / Chinese template]

This is a ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Branch merge
  • Other (about what?)

What's the background?

  1. Describe the source of requirement.
    输入-0 的时候 decimalValue.toNumber() 将 -0 变成了 0
  2. Resolve what problem.
    输入-0 的时候 decimalValue.toNumber() 将 -0 变成了 0 ,我想的是,在-0 或者 -0. 的时候,可以是字符串,测试覆盖率100%
  3. Related issue link.
    When InputNumber has a formatter attribute, it is not possible to enter a decimal with a negative zero point, such as -0.121 #6360

API Realization (Optional if not new feature)

  1. Basic thought of solution and other optional proposal.
  2. List final API realization and usage sample.
  3. GIF or snapshot should be provided if includes UI/interactive modification.

What's the effect? (Optional if not new feature)

  1. Does this PR affect user? Which part will be affected?
  2. What will say in changelog?
  3. Does this PR contains potential break change or other risk?

Changelog description (Optional if not new feature)

  1. English description
  2. Chinese description (optional)

Self Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

Additional Plan? (Optional if not new feature)

If this PR related with other PR or following info. You can type here.

@CCherry07
Copy link
Member Author

我的方案是一种投机取巧的方式,js 是能识别 -0 与 0 的

Number(-0)

image

并且在js中,严格意义下,-0 与 0 不等的

Object.is(-0,0) === false

image

@github-actions
Copy link

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Stale label May 26, 2023
@github-actions github-actions bot closed this Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant