Commit 51084982 authored by Hemery Mathieu's avatar Hemery Mathieu
Browse files

Remove try_to_cast_integer to use normalize_number

parent 176aeacb
......@@ -61,6 +61,7 @@
]).
% Only for separate compilation/linking
:- use_module(arithmetic_rules).
:- use_module(doc).
:- use_module(reaction_rules).
:- use_module(util).
......@@ -1464,10 +1465,10 @@ filter_denominator(X^Nr, Num/Den) :-
(
number(Nr)
->
util:try_to_cast_integer(Nr, N)
normalize_number(Nr, N)
;
parameter_value(Nr, Nt),
util:try_to_cast_integer(Nt, N)
normalize_number(Nt, N)
),!,
(
N<0
......
......@@ -957,21 +957,6 @@ atom_to_int(String, Int) :-
read_term_from_atom(String, Int, []),
integer(Int).
%! try_to_cast_integer(+Expr, -Result)
%
% Try to read Expr as an integer and return a float if it is not possible (discrepancy
% higher than 1e-9)
try_to_cast_integer(Expr, Result) :-
Putative_Float is Expr,
Putative_Int is integer(Putative_Float),
Discr is abs((Putative_Int-Putative_Float)/Putative_Float),
(
Discr < 1e-9
->
Result = Putative_Int
;
Result = Putative_Float
).
% what setof should have always been
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment