Comments (5)
Thank you for the test cases!
Most of them were caused by wrong treatment of unsigned longs in the code. I have fixed those.
I am going to look at the remaining ones next.
from fastdoubleparser.
Another class of inputs were wrong because the code did not compensate for skipped digits if there are more than 19 digits.
from fastdoubleparser.
For long inputs, the recommended approach is as follows:
https://github.com/fastfloat/fast_float/blob/main/include/fast_float/parse_number.h#L111-L116
Also in C# at
See section 11 in https://arxiv.org/pdf/2101.11408.pdf
from fastdoubleparser.
Thank you very much for the pointers to the corresponding code sections!
3be8131 includes now the code that you have marked in https://github.com/fastfloat/fast_float/blob/main/include/fast_float/parse_number.h#L111-L116.
When that fails, the code currently falls back to java.lang.Double.parseDouble(), so that all test cases should pass now.
I am planning to replace all fall back calls to Double.parseDouble() in upcoming commits.
For decimal floating point literals, I believe, it is best to port the parse_long_mantissa function from your C++ code, and everything that comes with it. Your class "decimal" appears to do the stuff that I need. (I tinkered with class java.math.BigDecimal. But it round-trips to a String which it then feeds into Double.parseDouble for doing the conversion - which kind of defeats the purpose).
I am not sure how to implement the corresponding cases for hexadecimal floating point literals. In this case, we have a number that is composed of 1^sign * mantissa * 2^exponent. I tried with the class java.math.BigInteger, but memory usage was too high. Thats why in 3be8131 the code currently only tries Clingers fast path, and then immediately falls back to Double.parseDouble.
from fastdoubleparser.
This is fixed in ac66003
This revision includes a port of the Decimal class from the C++ code in fast_float. However, it turns out that the code in OpenJDK class jdk.internal.math.FloatingDecimal is by at least by one order of magnitudes faster. So performance is better if method parseRestOfDecimalFloatLiteralTheHardWay() in FastDoubleParser just calls Double.parseDouble().
from fastdoubleparser.
Related Issues (20)
- FastDoubleParser doesn't support all input formats as the default OpenJDK Float/Double parsers HOT 10
- The parser throws StringIndexOutOfBoundsException/ArrayIndexOutOfBoundsException for some inputs HOT 6
- BigDecimal parser HOT 12
- Publish a multi-release JAR HOT 2
- Parsing of hexadecimal floating point numbers is broken in release 0.5.0 HOT 1
- Publish 0.5.2 to maven central HOT 2
- BigInteger parser HOT 6
- possible performance issue with very big doubles HOT 25
- Builds should be reproducible HOT 1
- Is this a mistake with hex float parsing? HOT 1
- Incorrect maven command sequence HOT 6
- Please bundle LICENSE/NOTICE files in the produced jar files HOT 49
- Implement faster slow path for double parser (JDK 21)
- Document which code signing keys will be used for published artifacts. HOT 2
- issue with module-info classes in v0.9.0 release HOT 3
- More efficient character group check HOT 1
- Bug: the highest bit of hexadecimal float significand ignored HOT 1
- Parser accepts invalid hex chars HOT 2
- NPE in "FastDoubleParser", method "JavaBigDecimalParser.parseBigDecimal()" HOT 1
- 1.0.0 release only supports very recent JVMs HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastdoubleparser.