Coder Social home page Coder Social logo

saline's People

Contributors

kinxer avatar respitesage avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

saline's Issues

Implement Patches on Numeric Types for Saturating Arithmetic

Currently, Saturating can't be used directly as the argument of Number arithmetic operations. You have to use Saturating#value. That seems non-ideal, so I should implement patches on numeric types to allow operations with Saturating on the right-hand side.

Add Division Operations to Saturating

Currently Saturating doesn't override division operators (they should still work, just without saturating arithmetic), but division by values between 0 and 1 could cause overflow. I expect the addition to match the existing code fairly well.

Allow Operations Between Saturating Objects with Different Generic Types

Currently, Saturating can only perform operations with Number types and Saturating objects with the same generic type. Instead, you should be able to add Saturating(T) with Saturating(U) for any T and U (and of course the same goes for other operations). In theory, this should be as easy as adding forall U and updating method definitions correspondingly.

Implement Saturating Types with Arbitrary Saturation Boundaries

It would be nice to have saturating arithmetic with saturation boundaries wherever you want. If, for example, you wanted to saturate at a much lower upper boundary than existing types (e.g. 30) or had some weird desired lower and upper boundaries (e.g. [32..210]), it would be nice to have types that would just act how you wanted instead of needing checks everywhere.

So far, I'm thinking that this could be accomplished by having another struct or class like so
Clamped(T,B,U) where T is the value type, like right now, B is a numeric lower bound, and U is a numeric upper bound. In theory, you could probably implement the existing Saturating struct as one of these new types, but structs can't inherit from non-abstract structs... It's worth thinking about.

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.