-
-
Notifications
You must be signed in to change notification settings - Fork 47.7k
Commit 338cbaf
lighting9999pre-commit-ci[bot]MaximSmolskiy
authoredImprove power.py (#12567)
* Fix And Add power.py
To fix the inaccuracies and allow handling of negative exponents and bases, the key issue lies in how negative numbers are handled in the power calculation, especially when dividing.
## Example Output:
```python
>>> power(4, 6)
4096
>>> power(2, 3)
8
>>> power(-2, 3)
-8
>>> power(2, -3)
0.125
>>> power(-2, -3)
-0.125
```
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update power.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update power.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update power.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update power.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>1 parent e59d819 commit 338cbaf
1 file changed
+7
-5
lines changedLines changed: 7 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | - | ||
1 | + | ||
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
22 | + | ||
23 | + | ||
22 | 24 |
| |
23 | - | ||
25 | + | ||
24 | 26 |
| |
25 | - | ||
27 | + | ||
26 | 28 |
| |
27 | 29 |
| |
28 | 30 |
| |
| |||
43 | 45 |
| |
44 | 46 |
| |
45 | 47 |
| |
46 | - | ||
48 | + | ||
47 | 49 |
| |
48 | 50 |
| |
49 | 51 |
| |
50 | 52 |
| |
51 | - | ||
53 | + |
0 commit comments