Skip to content

Commit

Permalink
release 1.4.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanonymous-GitHub committed Jun 11, 2020
1 parent ba46dc4 commit a42119e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="xmatrix",
version="1.4.5",
version="1.4.6",
author="Xanonymous",
author_email="[email protected]",
description="Help you calculate matrix.",
Expand Down
4 changes: 4 additions & 0 deletions xmatrix/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ def __pretty(self, r) -> str:
for i, x in enumerate(r):
for j, y in enumerate(x):
# try to turn the data to integer.
if r[i][j].imag == 0:
r[i][j] = r[i][j].real
if isinstance(r[i][j], complex):
if abs(r[i][j].real - int(r[i][j].real)) < 10 ** -4:
r[i][j] = int(r[i][j].real) + r[i][j].imag * 1j
Expand All @@ -254,6 +256,8 @@ def __pretty(self, r) -> str:
# the max floating point length in python is 16 so we use 15 to calculate.
if isinstance(r[i][j], float):
r[i][j] = self.__get_near_number(r[i][j], 15)
if r[i][j].imag == 0:
r[i][j] = r[i][j].real
# format the value then return
return '\n'.join(map(str, r)) + '\n'

Expand Down

0 comments on commit a42119e

Please sign in to comment.