Refined implementation of numeric/algorithm.ab
Fixed #248. Fixed #249.