Re:A Quick Introduction to R
by nightski on Sunday February 06, 2022 @10:25AM
(#30233298)
I agree with your point that all languages have their quirks. This is a very poor example however. If it automatically converted to float what would you do if you wanted integer division? I think automatic casting tends to get messy/be pretty evil in general but of course there are exceptions.
[ Parent
| on HN ]
Re:A Quick Introduction to R
by salamandersauce on Sunday February 06, 2022 @10:35AM
(#30233397)
You could always do something like:
int divRes = IntA/intB;
double something = divRes*5.342;
At the very least it could warn me. I just tried it in rust and that will error out if you try to divide two ints and store the result in a float which is fine by me.