Feat: no more round in quadratic roots
This commit is contained in:
parent
b93f34bc38
commit
aba43c9f19
@ -288,13 +288,15 @@ class Quadratic(Polynomial):
|
|||||||
return [round(eval(f"-{self.b}/(2*{self.a})"), 2)]
|
return [round(eval(f"-{self.b}/(2*{self.a})"), 2)]
|
||||||
else:
|
else:
|
||||||
from math import sqrt
|
from math import sqrt
|
||||||
|
|
||||||
roots = [
|
roots = [
|
||||||
round(eval(f"(-{self.b}-sqrt({self.delta}))/(2*{self.a})"), 2),
|
str(eval(f"(-{self.b}-sqrt({self.delta}))/(2*{self.a})")),
|
||||||
round(eval(f"(-{self.b}+sqrt({self.delta}))/(2*{self.a})"), 2),
|
str(eval(f"(-{self.b}+sqrt({self.delta}))/(2*{self.a})")),
|
||||||
]
|
]
|
||||||
roots.sort()
|
roots.sort()
|
||||||
return roots
|
return roots
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Reglages pour 'vim'
|
# Reglages pour 'vim'
|
||||||
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
|
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
|
||||||
|
Loading…
Reference in New Issue
Block a user