Skip to content

Commit 9ee1a2c

Browse files
authored
Merge pull request rougier#17 from ibah/master
Correcting solution to the 'round away from 0' exercise
2 parents 429db56 + 9e6559e commit 9ee1a2c

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

100 Numpy exercises.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@
585585
"# Author: Charles R Harris\n",
586586
"\n",
587587
"Z = np.random.uniform(-10,+10,10)\n",
588-
"print (np.trunc(Z + np.copysign(0.5, Z)))"
588+
"print (np.copysign(np.ceil(np.abs(Z)), Z))"
589589
]
590590
},
591591
{

100 Numpy exercises.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ print(np.array([np.nan]).astype(int).astype(float))
260260
# Author: Charles R Harris
261261

262262
Z = np.random.uniform(-10,+10,10)
263-
print (np.trunc(Z + np.copysign(0.5, Z)))
263+
print (np.copysign(np.ceil(np.abs(Z)), Z))
264264
```
265265

266266
#### 30. How to find common values between two arrays? (★☆☆)

0 commit comments

Comments
 (0)