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 MaxCoefficient static variable value in Decimal.cpp #6160

Closed
wants to merge 1 commit into from

Conversation

Ahmad-S792
Copy link
Contributor

@Ahmad-S792 Ahmad-S792 commented Nov 5, 2022

Fix MaxCoefficient static variable value in Decimal.cpp
https://bugs.webkit.org/show_bug.cgi?id=247514

Reviewed by NOBODY (OOPS!).

Merge - https://src.chromium.org/viewvc/blink?view=revision&revision=174294

Fix MaxCoefficient static variable value in Decimal.cpp to match the Precision
and the corresponding comment. Webkit uses 18 as precision and the comment says
MaxCoefficient should be 18 '9's in hexadecimal. However, 0x16345785D89FFFF is
99999999999999999 (17 '9's), not 18 '9's. The right hexadecimal value should be
0XDE0B6B3A763FFFF.

* Source/WebCore/platform/Decimal.cpp: Update "MaxCoefficient" static variable

812e7e8

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  πŸ§ͺ win
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-debug βœ… πŸ›  gtk βœ… πŸ›  wincairo
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv βœ… πŸ§ͺ mac-wk1
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2
βœ… πŸ›  watch βœ… πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  watch-sim βœ… πŸ§ͺ mac-wk2-stress

Fix MaxCoefficient static variable value in Decimal.cpp
https://bugs.webkit.org/show_bug.cgi?id=247514

Reviewed by NOBODY (OOPS!).

Merge - https://src.chromium.org/viewvc/blink?view=revision&revision=174294

Fix MaxCoefficient static variable value in Decimal.cpp to match the Precision
and the corresponding comment. Webkit uses 18 as precision and the comment says
MaxCoefficient should be 18 '9's in hexadecimal. However, 0x16345785D89FFFF is
99999999999999999 (17 '9's), not 18 '9's. The right hexadecimal value should be
0XDE0B6B3A763FFFF.

* Source/WebCore/platform/Decimal.cpp: Update "MaxCoefficient" static variable
@Ahmad-S792 Ahmad-S792 self-assigned this Nov 5, 2022
@Ahmad-S792 Ahmad-S792 added New Bugs Unclassified bugs are placed in this component until the correct component can be determined. WebKit Nightly Build labels Nov 5, 2022
@@ -48,7 +48,7 @@ static int const ExponentMax = 1023;
static int const ExponentMin = -1023;
static int const Precision = 18;

static const uint64_t MaxCoefficient = UINT64_C(0x16345785D89FFFF); // 999999999999999999 == 18 9's
static const uint64_t MaxCoefficient = UINT64_C(0xDE0B6B3A763FFFF); // 999999999999999999 == 18 9's
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this mistake has any effect. Would be nice to test it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I don't have any idea on how to write test for this change top of my head, any idea or suggestions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@darinadler - I tried to look into on how to write some test for it but I think it would be difficult at my novice level. Should I close this PR and leave comment on bugzilla for someone else to land this with testcase? Thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can land it without a test case.

In the end if we have no idea what the effect is, it’s not so great; we could be making things worse somehow even.

Would be good to seek out someone who has an idea what effect an incorrect maximum would have. But that need not delay merging this corrected constant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am not mistaken @cdumez did this change in Blink based on the commit, I think he might have some insight. If he can share any insight, it would be great else I would land it. I agree with you that without doing proper testing, we are just trying to shoot in the blind.

Copy link
Contributor

@cdumez cdumez Nov 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ahmad-S792 My change in Blink had an associated API test changes. Your cherry-pick doesn't so I think that's the issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like Blink has API test coverage for Decimal while WebKit doesn't. Seems like we should introduce some Decimal API tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened to std::decimal? Why can’t we use that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened to std::decimal? Why can’t we use that?

Is this a thing? I found a proposal for std::decimal but it's not clear to me after some googling that it is part of the standard.

@Ahmad-S792
Copy link
Contributor Author

Managed to find failing testcase due to this and another change and fixing both in one go via PR 7908.

@Ahmad-S792 Ahmad-S792 closed this Dec 20, 2022
@Ahmad-S792 Ahmad-S792 deleted the fix247514 branch March 23, 2023 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Bugs Unclassified bugs are placed in this component until the correct component can be determined.
Projects
None yet
5 participants