[fix] For the approximation in segment_ratio, change int to double