Closed kytrinyx closed 1 year ago
If I'm not mistaken this would require handling the new cases with
BigInt
.
You are correct, int
in Dart is limited to 64 bits. We have to use BigInt
Do you think this would be a good addition for this track?
Yes, I have been bitten by not using the correct numeric type in my Databases and code in the past. It's helpful to know. As far as I know, we don't cover this anywhere? @Stargator
Right now
armstrong-numbers
is listed as difficulty 1 (scale is 1-10). Would adding BigInt complicate matters enough that we would have to bump the difficulty up a bit? Do we want to do that?
The complexity would not increase. It is a matter of changing types. If we must increase the difficulty, I would say increase by 0.5
.
I don't have a strong opinion, but at the moment I'm leaning slightly in favor of leaving the exercise as is. I'm happy to be convinced otherwise, though.
The existing solutions would break for sure. However, it would be good dogfood for your test generator and see how it reacts?. Generating tests for this exercise would not be trivial!
To make the tests spec compliant and working, following changes would need to be made
Excellent. Difficulties are ints, not floats, so we could bump it to 2.
I will give this a shot.
As far as I know, we don't cover this anywhere? @Stargator
Correct. We don't use BigInt anywhere nor do we have anything related to databases.
I agree with devkabiir's response. This shouldn't be a change, despite breaking the current solutions.
The armstrong-numbers exercise has two new tests in problem-specifications.
New test specifications
``` { "uuid": "5ee2fdf8-334e-4a46-bb8d-e5c19c02c148", "description": "Armstrong number containing seven zeroes", "comments": [ "The numeric size of this input number is 108 bits. Consider skipping this test if appropriate." ], "scenarios": [ "big-integer" ], "property": "isArmstrongNumber", "input": { "number": 186709961001538790100634132976990 }, "expected": true } { "uuid": "12ffbf10-307a-434e-b4ad-c925680e1dd4", "description": "The largest and last Armstrong number", "comments": [ "The numeric size of this input number is 127 bits. Consider skipping this test if appropriate." ], "scenarios": [ "big-integer" ], "property": "isArmstrongNumber", "input": { "number": 115132219018763992565095597973971522401 }, "expected": true } ```If I'm not mistaken this would require handling the new cases with
BigInt
.Do you think this would be a good addition for this track?
Right now
armstrong-numbers
is listed as difficulty 1 (scale is 1-10). Would adding BigInt complicate matters enough that we would have to bump the difficulty up a bit? Do we want to do that?I don't have a strong opinion, but at the moment I'm leaning slightly in favor of leaving the exercise as is. I'm happy to be convinced otherwise, though.
@Stargator @devkabiir Thoughts?