GithubHelp home page GithubHelp logo

fpconv's People

Contributors

night-shift avatar nohomey avatar uplinkcoder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fpconv's Issues

Question regarding license

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

some inputs cause `fpconv_dtoa()` to output 25 characters

Documentation states that,

fpconv/src/fpconv.h

Lines 9 to 10 in 736864b

* The generated string will never be longer than 24 characters.
* Make sure to pass a pointer to at least 24 bytes of memory.

But some inputs cause 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.