night-shift / fpconv Goto Github PK
View Code? Open in Web Editor NEWFast and accurate double to string conversion.
License: Boost Software License 1.0
Fast and accurate double to string conversion.
License: Boost Software License 1.0
Hello night-shift,
the D Programming Language (dlang.org) is missing an implementation for converting floating point numbers to strings. At the moment a C function is called which has the big disadvantage that the conversion cannot be done at compile time.
(D has extremely good compile time and template features)
It would be genius if we could add your implementation to the D standard library.
This would solve a lot of problems we currently have.
The issue is, D is using the Boost license (https://www.boost.org/LICENSE_1_0.txt).
Boost and MIT license are not compatible.
Is there any chance you could publish your implementation also under the Boost license?
Please see also this forum post about your implementation
https://forum.dlang.org/thread/[email protected]
Kind regards
Andre
Documentation states that,
Lines 9 to 10 in 736864b
fpconv_dtoa()
to output 25 characters leading to a buffer overflow if the caller only allocated the minimal buffer space. An example input is -277. Such an input will cause a buffer overflow in the 'Exemplary usage' example,
void print(double d)
{
char buf[24 + 1]; // plus null terminator
int str_len = fpconv_dtoa(d, buf);
buf[str_len] = '\0';
printf("%s", buf);
}
int main() {
print(-151115727451828646838272.0);
return 0;
}
(for such a trivial example, may need to compile with -fsanitize=address
to clearly illustrate the fault)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.