Giter VIP home page Giter VIP logo

const_fixedp's People

Contributors

bors[bot] avatar unleashed avatar

Watchers

 avatar

const_fixedp's Issues

Consider adding support for `num`'s crate traits

The num crate contains several interesting traits which look useful for both making the internal representation of FixedP generic (either directly or via requirements on precision) and for exposing methods on that struct to other users. For example, there are traits to expose the checked addition/subtratcion/multiplication/division which could be useful for external generic code using those traits.

Support for specifying minimum integer precision, inner representation bits, or inner type

Currently an u64 is used internally by FixedP to represent the integral and fractional parts of a fixed point value.

Specifying requirements on the integral part does not necessarily mean the inner type must change, but it means some further checks would be needed, similar to what is now being tested now given the precision of the fractional part.

As part of that requirement we might want to choose a bigger or smaller internal representation, for which we would end up with a generic parameter that would either need to be computed or accepted as a type parameter.

Currently one cannot have default type parameters along const type parameters on stable Rust, so specifying an internal type would take a hit on ergonomics. When/if this is resolved it would be interesting to take a look at this option.

Can't write `impl<const Q: u8, const P: u8> TryFrom<FixedP<Q>> for FixedP<P>`

This is because a conflicting blanket impl exists already for the case where Q == P (ie. both types are exactly the same, with same precision const type parameter).

This is a reminder that perhaps at some point we should be able to specify that we want TryFrom for such cases where Q != P. This is currently solved by providing an inherent method to this end, but has the problem that it can't be used in generic code using TryFrom.

Perhaps at some point specialization can be used to make the blanket impl the one used when Q == P only?

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.