Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:18
erlang-dec
dec-fix-make.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File dec-fix-make.patch of Package erlang-dec
diff -Ndur dec/src/dec.erl dec-fix-make/src/dec.erl --- dec/src/dec.erl 2013-12-04 08:18:03.000000000 +0200 +++ dec-fix-make/src/dec.erl 2015-06-08 14:33:45.572575504 +0300 @@ -28,18 +28,18 @@ {N, 0}; make(X) when is_list(X) -> % Note that this will accept "-10.-1". Don't do that. - case lists:splitwith(fun(C) -> C =/= $. end, X) of - {Whole, []} -> - {list_to_integer2(Whole), 0}; - {Whole, [$., Digit | Frac]} when Digit >= $0 andalso Digit =< $9 -> - MinE = length(Frac), - N = list_to_integer2(Whole) * intpow(10, MinE) + case Whole of - [$- | _] -> - -list_to_integer(Frac); - _ -> - list_to_integer(Frac) - end, - {N, -MinE} + {Whole, Frac} = lists:splitwith(fun(C) -> C =/= $. end, X), + W = list_to_integer2(Whole), + case string:strip(Frac, right, $0) of + F when length(F) =< 1 -> {W, 0}; + [_|F] -> + MinE = length(F), + FI = list_to_integer(F), + WI = W * intpow(10, MinE), + {if + W < 0 -> WI - FI; + true -> WI + FI + end, -MinE} end; make(X) when is_binary(X) -> make(binary_to_list(X)).
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor