Giter Site home page Giter Site logo

kschu91 / largest-remainder-method Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 5.0 40 KB

A PHP implementation of the largest remainder method algorithm.

License: MIT License

PHP 96.59% Dockerfile 2.59% Makefile 0.82%
algorithm math php php-library rounding

largest-remainder-method's People

Contributors

kschu91 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

largest-remainder-method's Issues

Greater than 0 precision do not sum up to 100?

On the readme you give the example:


[
    18.562874251497007,
    20.958083832335326,
    18.562874251497007,
    19.161676646706585,
    22.75449101796407
]

Which, with a precision of 2, results in

Array
(
    [0] => 18.55
    [1] => 20.94
    [2] => 18.55
    [3] => 19.15
    [4] => 22.74
)

But this sums up to 99.93. Shouldn't it be 100? Seems like precision with anything other than 0 does not work.

not getting an expected result with 2 numbers

		$numbers = [
			23.98,
			23.98,
		];
		$lr = new LargestRemainder($numbers);

		$result = $lr->round();

		$this->assertSame(array_sum($result), 47.0);

Both numbers are getting rounded to 24.0 where I expect them to be 24, 23. Is this a bug or am I using this incorrectly?

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.