Support for fractional numbers with Numbers types
TetroGem opened this issue · comments
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
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?
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