Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define behaviour with non-integer arguments #16

Open
parzhitsky opened this issue Apr 16, 2020 · 2 comments
Open

Define behaviour with non-integer arguments #16

parzhitsky opened this issue Apr 16, 2020 · 2 comments
Labels
Change: minor [Issue / PR] describes a non-breaking change, such as adding a new functionality Domain: main [Issue / PR] describes change in the functionality, its optimization good first issue [Issue] can be addressed by a first-time contributor Priority: high [Issue / PR] must be addressed as soon as possible Type: improvement [Issue / PR] addresses lack of a functionality or an open possibility of enhancement

Comments

@parzhitsky
Copy link
Member

parzhitsky commented Apr 16, 2020

Due to specifics ot IEEE 754 standard (see https://0.30000000000000004.com), it is not that straightforward to implement ranges with non-integer arguments.

xrange(1, 0, -0.1);
// expected:
// (10) [ 1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1 ]
// actual:
// (11) [ 1, 0.9, 0.8, 0.7000000000000001, 0.6000000000000001, 0.5000000000000001, 0.40000000000000013, 0.30000000000000016, 0.20000000000000015, 0.10000000000000014, 1.3877787807814457e-16 ]

Perhaps, use https://github.com/MikeMcl/decimal.js (although, only a couple of methods from there are really needed)?

@parzhitsky parzhitsky added Change: minor [Issue / PR] describes a non-breaking change, such as adding a new functionality Domain: main [Issue / PR] describes change in the functionality, its optimization Pending: unclear [Issue] not yet fully defined Priority: medium [Issue / PR] should be addressed without delay Type: improvement [Issue / PR] addresses lack of a functionality or an open possibility of enhancement good first issue [Issue] can be addressed by a first-time contributor labels Apr 16, 2020
@parzhitsky
Copy link
Member Author

The smaller fork of decimal.js is here, — decimal.js-tiny

@parzhitsky parzhitsky removed the Pending: unclear [Issue] not yet fully defined label Apr 17, 2020
@parzhitsky parzhitsky linked a pull request Apr 24, 2020 that will close this issue
@parzhitsky parzhitsky changed the title Define behaviour with non-integer steps Define behaviour with non-integer arguments Apr 24, 2020
@parzhitsky parzhitsky added Priority: high [Issue / PR] must be addressed as soon as possible and removed Priority: medium [Issue / PR] should be addressed without delay labels May 13, 2020
@parzhitsky
Copy link
Member Author

Rescheduled to 2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Change: minor [Issue / PR] describes a non-breaking change, such as adding a new functionality Domain: main [Issue / PR] describes change in the functionality, its optimization good first issue [Issue] can be addressed by a first-time contributor Priority: high [Issue / PR] must be addressed as soon as possible Type: improvement [Issue / PR] addresses lack of a functionality or an open possibility of enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant