MinoruSekine / libfixedpointnumber

Library for fixed point number by C++11
GNU Lesser General Public License v3.0
3 stars 2 forks source link

String which has long decimal part makes invalid fixed_t #199

Open MinoruSekine opened 3 years ago

MinoruSekine commented 3 years ago

Describe the bug

To Reproduce Steps to reproduce the behavior:

  1. Define fixed_t typed value like as fixed_t kPi("3.1415926535");
  2. It makes fixed_t which has invalid value

Expected behavior

Additional context

MinoruSekine commented 3 years ago

This addition to test occurs this issue.

MinoruSekine commented 3 years ago

Necessary solutions will be classified into some parts.

MinoruSekine commented 4 months ago

FromStringToDecimalIntImpl() doesn't check integral overflow by long string. If cut too long string before conversion, it have to recognize "it is too long or not".

MinoruSekine commented 4 months ago

Without cutting too long string before conversion, codes like below may recognize overflow will be occurred or not.

std::numeric_limits<T>::max() / next_digit < current_value