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

Support for fractional numbers with Numbers types #87

Open
TetroGem opened this issue Apr 14, 2023 · 1 comment
Open

Support for fractional numbers with Numbers types #87

TetroGem opened this issue Apr 14, 2023 · 1 comment

Comments

@TetroGem
Copy link

Currently, trying to use a non-integer will only perform the operation on the integer portion of the number:

import { Apply, Numbers } from "hotscript";

type DoubleHalf = Apply<Numbers.Mul, [0.5, 2]>; // evaluates to 0
type DoubleTwoPointFive = Apply<Numbers.Mul, [2.5, 2]>; // evaluates to 4

Playground link

Couldn't find any mention of it on this repo, so just was wondering if this is unintentional, planned to be implemented, or not being added?

@ecyrbe
Copy link
Collaborator

ecyrbe commented Apr 14, 2023

It's not supported indeed. Would it be possible ? Definitely.
Is it worth implementing it ? depends on use cases.
The already implemented number features are already borderline useful.

To answer the question, i was not planning on adding floating point capability.
But PR are welcomed.
I would however suggest anyone interested in implementing it to Implement it Using a Floats namespace to not have impact on the Numbers perf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants