commonlib: Add support for rational number approximation

This patch adds a function to calculate best rational approximation
for a given fraction and unit tests for it.

Change-Id: I2272d9bb31cde54e65721f95662b80754eee50c2
Signed-off-by: Vinod Polimera <quic_vpolimer@quicinc.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/66010
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/commonlib/Makefile.inc b/src/commonlib/Makefile.inc
index 2477e07..e90ed4f 100644
--- a/src/commonlib/Makefile.inc
+++ b/src/commonlib/Makefile.inc
@@ -21,6 +21,9 @@
 smm-y += region.c
 postcar-y += region.c
 
+romstage-y += rational.c
+ramstage-y += rational.c
+
 ramstage-$(CONFIG_PLATFORM_USES_FSP1_1) += fsp_relocate.c
 ifeq ($(CONFIG_FSP_M_XIP),)
 romstage-$(CONFIG_PLATFORM_USES_FSP2_0) += fsp_relocate.c