- /* Transform e.g. 10^-03 to 1000 as the array stores the inverse. */
- f = pow(10, abs(e));
-
- /*
- * Adjust the significand/factor pair to make sure
- * that f is a multiple of 1000.
- */
- while ((int)fmod(log10(f), 3) > 0) {
- s *= 10;
-
- if (e < 0)
- f *= 10;
- else
- f /= 10;
- }
-
- /* Truncate s to circumvent rounding errors. */
- s_int = (unsigned int)s;
-
- for (i = 0; i < array_len; i++) {
- if ((s_int == array[i][0]) && (f == array[i][1])) {
+ for (int i = 0; i < array_len; i++) {
+ sr_rational_set(&aval, array[i][0], array[i][1]);
+ if (sr_rational_eq(&rval, &aval)) {