CodingTrain / CodingTrain/Suggestion-Box
float and ".0"
- Dominant language
- No language data
- Stars
- 570
- Forks
- 85
- PR merge metrics
- No merged PRs in 30d
Description
Hi Dan,
It'd be great if you could add (as an addendum to the beginner's videos about variables for instance, or find the good occasion in any other video) the following reminder and warning about floating point variables in Processing (unless I am missing something).
Is there any way to prevent this (by setting a "mode" up) or should we always add the extra ".0"?
```
float t;
t = 49/100;
println(t); // returns .... 0.0
t = 49.0/100; // note the extra ".0"
println(t); // returns .... 0.49
t = 48/10;
println(t); // returns .... 4.0
t = 48/10.0; // again just an extra ".0"
println(t); // returns .... 4.8
```
Yep, I spent some time today debugging an issue in one of my sketches that ended-up being just that!
(and it's not even the first language with which I have the same issue.)
Thanks a mil'!
FredL
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.