Skip to content

Commit

Permalink
Re-implemented the ecvt function. (dotnet#12894)
Browse files Browse the repository at this point in the history
* Re-implemented the ecvt function.

Instead of leveraging snprintf, re-implement the ecvt function according to the paper: https://www.cs.indiana.edu/~dyb/pubs/FP-Printing-PLDI96.pdf

Note:
1. This commit won't fix any existing bug.
2. This is a raw implementation of the paper. The performance on Linux only gain 10%. We could tune the performance further.

Fix #10651

* Resolve a cross platform header file issue.

Fix #10651

* Fixed a minor bug. Improved the performance.

Fix #10651

* Modified code according to code review feedback.

This commit fixed most of the issue found in code review. However, some of the feedback may not be involved due to either little performance improvement or need a POC.

Fix #10651

* Try to fix constexpr compile error on Windows.

Fix #10651

* Fixed a potential overflow bug in BigNum::Compare.

Fix #10651

* Improved multiply 10 operation.

Use shift and add operation to replace actual multiply operation.

Fix #10651

* Remove old _ecvt function.

Fix #10651

* Documented the reason why we do not need m+ and m-.

Fix #10651

* Changed exp > 0 to exp != 0 to remove any confusion.

exp should fall in 1 ~ 2046 for normalized value. Denormalized value has exp = 0.

Fix #10651

* Disable the _ecvt tests.

Fix #10651

* Removed _ecvt tests.

Fix #10651

* Re-implemented LogBase2.

Fix #10651

* Use DWORD and DWORD64 for _BitScanReverse and _BitScanReverse64

Fix #10651

* Fixed x86 compile issue for _BitScanReverse64

x86 does not support _BitScanReverse64 so we have to add additional shift operations to handle it.

Fix #10651

* Implemented BitScanReverse64 and BitScanReverse in pal.h

Fix #10651

* Remove the confusion comment which is unrelated to BitScanReverse.

Fix #10651

* Introduced wmemset to enhance the perf for 0.0

Fix #10651

* Improved the performance of converting 0.0.

Fix #10651

* Renamed ecvt to DoubleToNumberWorker.

Fix #10651

* Updated code according to the code review feedback.

Fix #10651
  • Loading branch information
mazong1123 authored and tarekgh committed Sep 13, 2017
1 parent 13c7d39 commit 602ebe9
Show file tree
Hide file tree
Showing 14 changed files with 1,088 additions and 346 deletions.
1 change: 1 addition & 0 deletions src/classlibnative/bcltype/CMakeLists.txt
Expand Up @@ -7,6 +7,7 @@ endif(PerfCountersSupportedBuild)
set(BCLTYPE_SOURCES
arraynative.cpp
arrayhelpers.cpp
bignum.cpp
currency.cpp
decimal.cpp
windowsruntimebufferhelper.cpp
Expand Down

0 comments on commit 602ebe9

Please sign in to comment.