Getting Clock period Mismatch Error while comparing two clocks even though values of two clocks are same

In reply to chakrik:

Floating point numbers can not be compared directly because of rounding errors and representation. For example, 1/3 can not be stored exactly in a floating point number. For example, ((1.0 / 3.0) * 3.0) != 1.0

Take a step back. Do you really care if the two periods are only different by 1fs? 100fs? Build this into your comparison.

if((exp_period - actual_period) > 100fs)
  $error("clock check clkout_dig0 actual period %0f expected period %0f",
         actual_period, exp_period);