Parse float and create Explicable_float
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
from .generic import Stack, flatten_list, expand_list, isNumber, isOperator, isNumerand
|
||||
from .str2tokens import str2tokens
|
||||
from .operator import op
|
||||
from .explicable import Explicable, Explicable_int
|
||||
from .explicable import Explicable, Explicable_int, Explicable_float
|
||||
|
||||
from .random_expression import RdExpression
|
||||
|
||||
@@ -109,6 +109,10 @@ class Expression(Explicable):
|
||||
if isinstance(token, Explicable_int) or isinstance(token, int):
|
||||
return Explicable_int(token)
|
||||
|
||||
# TODO: J'en arrive au soucis même soucis qu'avec les fractions qui une fois simplifiée devrait être des Explicable_int. Mais comment on ne redéfini pas les opérations, ce sont les opérations des int qui se font et donc on perd toute l'historique. |sam. févr. 13 18:57:45 EAT 2016
|
||||
if isinstance(token, Explicable_float) or isinstance(token, float):
|
||||
return Explicable_float(token)
|
||||
|
||||
elif hasattr(token, 'simplify') and hasattr(token, 'explain'):
|
||||
ans = expression.postfix_tokens[0]
|
||||
return ans
|
||||
|
||||
Reference in New Issue
Block a user