RE: Nat_sort problems
- Posted by Andy Serpa <ac at onehorseshy.com> Aug 11, 2003
- 411 views
Derek Parnell wrote: > > > Tony, > changing x2num, x1num to integers doesn't work either because atoms > can't hold very large numbers either. > > Another technique will be required for this problem. > > There are big-number libraries available so you might have to use these > but I suspect a different approach to the natural sort algorithm might > be be faster. Just not sure yet. > How big are these numbers gonna be? nat_sort.e is made for sorting filenames & such, not doing string math. It ought to work for anything within atom range (after redeclaring x1num & x2num as atoms), although it won't work with representations (in the original string) like "1e20". However, it should work fine with strings like "100000000000000000000". The original version just left the strings as strings and padded the shorter one with leading zeros for comparison, but it was much slower, at least the way I did it back then...