| ... | @@ -1,7 +1,7 @@ | ... | @@ -1,7 +1,7 @@ |
| 1 | // Special Cases: | 1 | // Special Cases: |
| 2 | // | 2 | // |
| 3 | // powi(x, +-0) = 1 for any x | 3 | // powi(x, +-0) = 1 for any x |
| 4 | // powi(0, y) = 1 for any y | 4 | // powi(0, y) = 0 for any y |
| 5 | // powi(1, y) = 1 for any y | 5 | // powi(1, y) = 1 for any y |
| 6 | // powi(-1, y) = -1 for for y an odd integer | 6 | // powi(-1, y) = -1 for for y an odd integer |
| 7 | // powi(-1, y) = 1 for for y an even integer | 7 | // powi(-1, y) = 1 for for y an even integer |
| ... | @@ -29,7 +29,7 @@ pub fn powi(comptime T: type, x: T, y: T) (error.{ | ... | @@ -29,7 +29,7 @@ pub fn powi(comptime T: type, x: T, y: T) (error.{ |
| 29 | } | 29 | } |
| 30 | | 30 | |
| 31 | switch (x) { | 31 | switch (x) { |
| 32 | // powi(0, y) = 1 for any y | 32 | // powi(0, y) = 0 for any y |
| 33 | 0 => return 0, | 33 | 0 => return 0, |
| 34 | | 34 | |
| 35 | // powi(1, y) = 1 for any y | 35 | // powi(1, y) = 1 for any y |