3 ms·
I mean I get the idea but No floating point datatypes No ... switch statements or do...while loops seem like terrible things to leave out, occasional gotc
by Avshalom 9y ago
I mean I get the idea but
No floating point datatypes
No ... switch statements or do...while loops
seem like terrible things to leave out, occasional gotchas of floating point not with standing being only integers means no division
- lou1306 9y agoNo floating point types is a little harsh, but IMHO one should only use them when they really understand their implications. Otherwise they might be tempted to do Bad Stuff like using float for currencies, etc.
- instruction-ptr 9y ago“No division”? How do you reason this? Integer division is a thing
- Avshalom 9y agodivision is not defined on the set of integers, you only have modular arithmetic.
- instruction-ptr 9y agoSee section 7 of http://www.cs.cmu.edu/~15122/handouts/02-ints.pdf http://www.cs.cmu.edu/~15122/handouts/02-ints.pdf (As an aside nearly every language defines division on the set of integers this way so it’s not even like we’re making this up)
- jameshart 9y agodivision is also not defined on the set of IEEE binary floating point numbers, you only have (well-defined) rounding. For that matter, addition and subtraction aren't defined on the range of fixed-bit-width integers.
- recursive 9y agoIt is defined and you can do it in C without using floats. On the other hand, even if you do use floats, arbitrary arithmetic is not invertible. In other words a / b * b isn't necessarily a, regardless of what types they are.
- baby 9y agoWhat do you mean division is not defined on the set of integers? Mathematically or programmatically? Because yes you have euclidean divisions which are divisions for the integers.
- rootbear 9y agoThe first structured programming language I learned was a home grown language called Simpl-T, at the University of Maryland. It did not have floating point, but one could still do an awful lot with it. Other members of the Simpl-X family did have floating point, as I recall.