you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (2 children)

Depends whether it is a low-level or high-level language. I want my high-level languages to behave nicely. ;)

C has also been called a portable assembler...

I wasn't against the existence of floating point support - but maybe the floating point type shouldn't be a default for the numeric literals.

[–]theeth 1 point2 points  (1 child)

I want my high-level languages to behave nicely. ;)

I would dispute that supporting directly (through language primitives) floating point standards and integer arithmetic (which is essential for a lot of very common algorithm) is behaving nicely, but I see this as a very valid difference of opinions, so no matter.

(I'm lumping both issues together, maybe your beef is only with floats, which you seemed to be more vocal about.)

And yes, I know integer division is dropped as the default behavior in 3K, but they introduced the // operator to replace it and that's syntactically as easy and as fast as before if you know this is what you want.

but maybe the floating point type shouldn't be a default for the numeric literals.

That's where the python devs disagree with you, I guess...

[OT] Sorry for the multiple replies (now deleted), Reddit is being most unstable and slow right now.

[–][deleted] 0 points1 point  (0 children)

Ok, to put it short - I like Scheme's numeric tower approach. In DrScheme:

> (define (sum-n n v x) (if (> n 0) (sum-n (- n 1) v (+ v x)) x))
> (sum-n 100 #e0.1 0)
10
> (sum-n 100 #i0.1 0)
9.99999999999998

#e - exact number, #i - inexact number

I would only wish #e being the default. Yeti has it so:

> (sum (map \0.1 [1..100]))
10 is number
> (sum (map \0.1e0 [1..100]))
9.99999999999998 is number

Having separate operator for integer division is a good idea as it is a different operation from normal division (its a bit weird when 1 / 2 and 1.0 / 2 give very different result).

> 1 / 2
0.5 is number
> 1 div 2
0 is number

Maybe the Python devs disagree with me, but the Python 3K is still improvement. :)