GithubHelp home page GithubHelp logo

fixed's People

Contributors

jaypha avatar moodleladycow avatar oleobal avatar pdenapo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

fixed's Issues

asString vs toString ?

if you add alias toString = asString to the Fixed structure this would allow pretty printing and automating formating of the value (write, writeln, format, std.conv.to, etc.).

Any reason explaining why you don't use it ?

Speed?

Now does the speed of this compare to floats or plain longs? Have you done any benchmarking?

string constructor should not use double

First, the whole reason to have a fixed-point system is to avoid the vagaries of floating point. I do not want a string to parse in a fixed representation that will be incorrect. e.g.:

auto f = Fixed!2("10000000000000005.00");
writeln(f); // 10000000000000004.00

Second, it requires sscanf, under the hood. It does black magic. I'd rather not rely on black magic. Or libc if possible ;)

Third, parsing 2 integers instead of a double is way faster. Again parsing floating point is black magic, and really really hard to get right. It's why D still relies on sscanf.

I was considering using this in a project of mine. But I can't accept this limitation. I may create a PR if this might be approved. But the statement in the readme saying "Perhaps change the string -> fixed algorithm to avoid using floating point. Not sure if it is worth the effort" gives me pause.

Let me know.

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.