From Floating-Point Values to Subscription Quotas: A Reproducible Estimation Method
This article starts with an unrounded floating-point number and shows how to recover its exact rational form, including a Stern-Brocot tree implementation for finding the simplest fraction within a given error and denominator limit. It then explains what such a fraction can and cannot prove about subscription quotas, and offers a practical three-step template for measuring your own usage, utilization, and unit cost from billing data.
An Unusual Decimal
0.16327272727272726 has 17 decimal places. Usage numbers shown in a UI usually keep only two to four decimal places, so this value looks more like a raw program output, such as the unrounded result of a division.
This is common. When floating-point numbers are printed, they may retain all significant digits needed to distinguish the internal value. Seeing a long string of digits does not mean the business data contains a secret. The only thing that can be established is the mathematical property of the number itself. Its connection to any specific quota ceiling requires separate proof.
Recover the Fraction First
This decimal has a repeating part. The first four digits after the decimal point are 1632, and from the fifth digit onward, “72” repeats indefinitely. The repeating part 0.7272… equals 8/11, so:
0.16327272… = 0.1632 + (8/11) × 10^-4 = 1632/10000 + 8/110000 = 17960/110000 = 449/2750
Check: 2750 × 0.1632727… ≈ 449.0. Since 2750 = 2 × 5³ × 11 and 449 is prime, the two have no common factor, so 449/2750 is already in lowest terms.
The difference between this fraction and the original floating-point value is on the order of 10^-17, which is normal rounding error for double-precision floating point. In other words, 449/2750 is the exact identity of this number, not an approximate guess.
How the Stern-Brocot Tree Works
The Stern-Brocot tree enumerates all positive rational numbers. It starts with two boundary fractions, 0/1 and 1/0, and at each step takes the mediant of the two boundary fractions—the fraction whose numerator and denominator are the sums of the corresponding numerators and denominators. If the target value is greater than the mediant, move the left boundary to the mediant; if it is smaller, move the right boundary. Repeating this process gradually approaches the target value.
To find the “closest simplest fraction,” you need three parameters: the target value x, the allowed error eps, and the denominator limit max_den. Here is a minimal implementation:
def simplest_fraction(x, eps, max_den):# Initial boundaries 0/1 and 1/0, for x > 0ln, ld, rn, rd = 0, 1, 1, 0while True:mn, md = ln + rn, ld + rd # Mediantif md > max_den:return None # Denominator exceeds limit before a matchm = mn / mdif abs(m - x) < eps:return (mn, md) # Error threshold met; stopif m < x:ln, ld = mn, md # Target is to the right of the mediantelse:rn, rd = mn, md # Target is to the left of the mediant
This algorithm returns the fraction with the smallest denominator within the error range. The depth of a node in the tree is related to the size of its denominator. Moving down the search path, the first node that falls inside the error interval is the simplest one.
The returned result depends on eps. For the same number, different error settings produce different answers.
- With eps = 10^-12 and max_den = 10000, the result is 449/2750.
- With eps = 10^-5, the result is 8/49. 8/49 is approximately 0.1632653, which differs from the target by about 7.4 × 10^-6 and falls within the error range.
So “simplest fraction” is not a unique property of the value itself; it means “the simplest fraction under a given error.” When reporting a result, you should state both eps and max_den.
There is also a performance consideration. When the integer part of x is large, walking the tree step by step can be slow. In engineering practice, continued fraction expansion is usually used instead to obtain the same result in a few steps.
What This Method Can and Cannot Show
The recovered fraction answers only one mathematical question: which fraction equals this decimal. It cannot directly answer “what is the quota of a given plan.”
To connect the fraction to a quota, at least three types of evidence are needed.
- Multiple independent observations. A single number may simply be a byproduct of one calculation; multiple data points are needed to test whether a pattern is stable.
- A clear measurement definition. You need to know what the numerator and denominator correspond to—for example, the consumption rate of a model and the ceiling of a tier—before the conclusion is meaningful.
- Reproducible measurement conditions. Record the time, account tier, model selection, and conversation length; otherwise, others cannot reproduce the result.
Without these conditions, any conclusion drawn from a single number is only a hypothesis. The reverse-engineering process itself should not be treated as a way to obtain internal information. Reviewing the terms of service and using only the normal features of your own account is the safer approach.
A Three-Step Template for Measuring Your Own Bill
Rather than reverse-engineering internal numbers, it is better to record your own usage directly. The template below can be completed within one week.
Step one: record usage. For each session, note the date, model, number of turns, and the change in usage shown in the UI. Different models may have different consumption rates, so record them separately.
| Date | Model | Turns | Usage Change | Notes |
|---|---|---|---|---|
| Monday | Model A | 12 | 35k | Long-text analysis |
| Monday | Model B | 30 | 20k | Simple Q&A |
Step two: calculate utilization. Utilization equals actual consumption divided by available quota. Available quota is constrained not only by the 5-hour rolling quota but also by the weekly cap; use the smaller of the two. If utilization stays low for a long time, the current tier may be higher than necessary. If you frequently hit the ceiling, you may need to upgrade.
Step three: calculate unit cost. Unit cost equals the plan price divided by the measured quota, then converted to cost per 10,000 units. The following three tiers are hypothetical examples only and do not correspond to any real service:
- Tier A: price $20, 5-hour quota 550k, unit cost about $0.364 per 10k units;
- Tier B: price $100, 5-hour quota 3.3M, unit cost about $0.303 per 10k units;
- Tier C: price $200, 5-hour quota 7M, unit cost about $0.286 per 10k units.
Under this set of assumptions, the higher the tier, the lower the unit cost. But a low unit cost is meaningful only if you actually use the full quota. If your actual usage is only one-third of Tier A’s quota, the effective cost of Tier A is lower instead.
Check Advertised Multiples
Advertisements often say that one tier is “several times” a base tier. The check is simple: divide each tier’s measured quota by the base tier’s measured quota to obtain the actual multiple. To reduce random error, measure at least three times and record the difference between the maximum and minimum values. If the three results differ greatly, the measurement conditions are unstable, and you should not draw a conclusion.
Error and Risk Notes
The conclusions from this template have several limitations that should be considered.
- Small sample size. One week of data reflects only recent habits, not the whole year.
- The time window affects readings. Rolling quotas recover over time, so readings differ depending on when they are taken.
- Units are not unified. Usage shown in the UI, internal model metering, and billing amounts may use different units; confirm the units before converting.
- Privacy protection. Before sharing screenshots, mask account, email, and payment information.
- Compliance boundaries. Measure only data visible in your own account; do not scrape APIs or bypass usage limits.
Conclusion
An unrounded floating-point number can serve as a starting point for practice. Using a Stern-Brocot tree to recover a fraction teaches a useful numerical-analysis method. But what is truly useful for subscription decisions is a repeatable process for recording and calculation. Put usage, utilization, and unit cost in the same table, and the differences between tiers become clear without relying on advertised multiples.
