Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Huh?

Name: Anonymous 2010-04-14 10:44

Python 2.6.5
>>> i = -3
>>> i ** 0
1
>>> -3 ** 0
-1


GHCi, version 6.10.4
Prelude> let i = -3
Prelude> i ^ 0
1
Prelude> -3 ^ 0
-1

Name: Anonymous 2010-04-14 10:45

Mmm, precedence.

Name: Anonymous 2010-04-14 10:49

Powers are evaluated before subtraction
so it's implicitly -(3^0) = -(1)
but substitute i and it is (-3)^0 = 1

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List