Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • Location
    Oldenburg, Germany

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Patrick's Achievements


Member (1/2)



  1. Hi, while implementing a project I noticed that my calculations using sc_dt::sc_ufix won't get more accurate when increasing the fractional bit width. As you can see in the following example I'm increasing the number of fractional bits and calculate 1/3: #include <iostream> #include <iomanip> #include <systemc.h> int sc_main(int argc, char *argv[]) { { int i = 9; do { sc_fxtype_context evalContext(sc_fxtype_params(i, 8)); sc_dt::sc_ufix a = 1; sc_dt::sc_ufix b = 3; sc_dt::sc_ufix r = a / b; std::cout << std::setw(3) << std::setfill('0') << i - 8; std::cout << " | " << r << " | " << r.to_bin() << std::endl; i++; } while (i < 120); } return (0); } While the results look as expected at first, they won't change any more after the 64th fractional bit (output.txt). Why is this happening? I can use fractional bits >= 64 (e.g. by shifting to the right), but my calculations don't use them. None of them uses any bits beyond the 64th, thus increasing the fractional accuracy has no effect. Searching in the standard I wasn't able to find a restriction for calculations with finite-precision fixed-point numbers, only for different types (limited-precision fixed-point calculations like sc_dt::sc_ufix_fast for example should not exceed 53 bits).
  • Create New...