Re:C0, an Imperative Programming Language for Novice Compute...
by Avshalom on Wednesday October 18, 2017 @11:25AM
(#15499887)
I mean I get the idea but
seem like terrible things to leave out, occasional gotchas of floating point not with standing being only integers means no division
[ Parent
| on HN ]
Re:C0, an Imperative Programming Language for Novice Compute...
by lou1306 on Wednesday October 18, 2017 @11:37AM
(#15500018)
No 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.
Re:C0, an Imperative Programming Language for Novice Compute...
by instruction-ptr on Wednesday October 18, 2017 @11:38AM
(#15500029)
“No division”? How do you reason this? Integer division is a thing
Re:C0, an Imperative Programming Language for Novice Compute...
by Avshalom on Wednesday October 18, 2017 @11:46AM
(#15500114)
division is not defined on the set of integers, you only have modular arithmetic.
Re:C0, an Imperative Programming Language for Novice Compute...
by instruction-ptr on Wednesday October 18, 2017 @11:52AM
(#15500179)
See section 7 of 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)
Re:C0, an Imperative Programming Language for Novice Compute...
by recursive on Wednesday October 18, 2017 @12:11PM
(#15500346)
It 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.
Re:C0, an Imperative Programming Language for Novice Compute...
by baby on Wednesday October 18, 2017 @12:14PM
(#15500384)
What 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.
Re:C0, an Imperative Programming Language for Novice Compute...
by jameshart on Wednesday October 18, 2017 @12:05PM
(#15500301)
division 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.
Re:C0, an Imperative Programming Language for Novice Compute...
by rootbear on Wednesday October 18, 2017 @12:19PM
(#15500425)
The 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.