Understanding the equation in Emonlib to convert sample reading to actual current value

From the library, to convert the sample reading to current is:

double I_RATIO = ICAL *((SupplyVoltage/1000.0) / (ADC_COUNTS));
Irms = I_RATIO * sqrt(sumI / Number_of_Samples);

Short form:
Irms = (Sample_RMS/ADC_COUNTS) * VREF * ICAL

Assume, if Sample_RMS = 500, VREF = 3.3V, ADC_COUNTS = 1024, the ct sensor is SCT-013-000, ICAL = 2000/22 = 90.9.

The Irms will equal to 146.47A which is much larger than the 100A.

What I had wrong understand at here? Is the ICAL is a random number?

No, it is the current in the c.t. primary winding (i.e the cable) that gives 1 V at the ADC input. Both current and voltage must be expressed in the same measurement type - both rms average, or both peak, or both peak-peak, etc.

Your problem is, why or how can Sample_RMS = 500 be true? If you have a true sine wave input of 1024 counts peak-peak, what will the rms be in counts?

Sample_RMS = 500 can only ever be true under one very unusual condition. What is that? (Hint: think about what shape of wave you will need, given the maximum amplitude is 512 counts.)