Sacrificial Weapon Bug: How Math.floor Broke ER
We found a Math.floor vs Math.ceil bug in Sacrificial weapon ICD calculations. Sucrose lost ~20% ER in Bennett National. Here's the fix.

Download Wallpaper
Save this image for personal use only
TL;DR
- The bug: We used
Math.floorinstead ofMath.ceilfor the Sacrificial weapon ICD cap. - The impact: In 20s rotations with 30s ICD (R1), the cap was 0 extra casts — it should be 1.
- Affected characters: Xingqiu, Sucrose, Diona, Sayu — anyone using Sacrificial weapons.
- The fix: Sucrose in Bennett National drops from 137% ER to 117% ER — the correct value.
- The change: 1 character, 1 line. Commit applied 2026-07-01.
The Discovery
During a data audit of the calculation engine, we found something that didn't add up. In the code that calculates extra casts for Sacrificial weapons — one of the most widely used weapon families in Genshin Impact — the ICD cap used Math.floor. And Math.floor was producing incorrect results for most standard rotations.
The exact line in service-weapon-sacrificial.ts:
// ❌ Before:
const maxExtraFromICD = Math.floor(rotationDuration / internalCD)
// ✅ After:
const maxExtraFromICD = Math.ceil(rotationDuration / internalCD)
Why Math.floor Was Wrong
The Sacrificial weapon ICD (Internal Cooldown) starts after the first proc. The first skill hit always gets a chance to trigger the effect — it's not limited by the ICD because the ICD hasn't started yet.
In a 20s rotation with a Sacrificial Bow R1 (ICD = 30s):
Math.floor(20 / 30) = 0— Says: "0 extra casts max, ICD is longer than rotation"Math.ceil(20 / 30) = 1— Says: "1 extra cast possible, first hit always gets its chance"
floor completely erased the first proc attempt. ceil is the correct bound: you always get at least 1 opportunity, then the ICD limits subsequent ones.
Affected Characters
This bug affects any character using Sacrificial weapons in rotations where ICD > rotation duration, or where the division isn't exact:
| Character | Weapon | Refinement | ICD | Rotation | Before (floor) | After (ceil) |
|---|---|---|---|---|---|---|
| Xingqiu | Sacrificial Sword | R1 | 30s | 20s | 0 | 1 |
| Sucrose | Sacrificial Fragments | R3 | 22s | 20s | 0 | 1 |
| Diona | Sacrificial Bow | R1 | 30s | 20s | 0 | 1 |
| Sayu | Sacrificial Greatsword | R1 | 30s | 20s | 0 | 1 |
| Xingqiu | Sacrificial Sword | R5 | 16s | 20s | 1 | 2 |
Real Case: Sucrose in Bennett National
The most striking case was Sucrose with Sacrificial Fragments R3 in the classic Bennett National team (Xiangling / Xingqiu / Bennett / Sucrose). 20s rotation, 22s ICD:
Sucrose (HYBRID, 80 burst, Sac Frag R3) ER:
❌ Before (Math.floor): 137% ER (expected range 123-151%)
✅ After (Math.ceil): 117% ER (real range 105-129%)
A ~20-point ER difference. With the bug, the calculator said Sucrose needed 137% — when the real value is 117%. That's ~4 ER substats that could go into EM or Crit instead.
The other team members (Xiangling, Xingqiu, Bennett) weren't affected because their weapons aren't Sacrificial.
Why We Didn't Catch It Sooner
This code had been in place since the calculation engine rewrite. Integration tests checked ER ranges, but those ranges had been calibrated against the incorrect engine behavior. It took a manual code audit — comparing the ICD logic against actual in-game mechanics — to spot the discrepancy.
Once we identified the bug, 7 tests failed. All were Sucrose. All expected the wrong value. We updated the fixtures and now all 894 tests pass with the correct behavior.
How to Verify Your Builds
If you use ER QuickCalc with Sacrificial weapon characters, your calculations already use the corrected value. Just re-calculate your team and the new numbers reflect the fix.
To verify manually:
- Select a character with a Sacrificial weapon (Xingqiu, Sucrose, Diona, Sayu)
- Set up your team in ER QuickCalc
- Check the recommended ER — if it dropped vs your previous build, the fix is working correctly
Technical note: This fix is part of commit 1864ae3 (2026-07-01). We caught it during the S113 data audit session alongside other pipeline precision fixes. The change was reviewed by a 7-agent deliberation panel before being applied.
Related Posts

C6 or Nothing: 4-Star Supports Hiding Their Real Kit
Faruzan and Diona do almost nothing before C6. How to spot a constellation-gated support before you spend a single pull.

Qiqi 6.7 Buff: From 0 to 4 Particles
Qiqi's particle data was stuck at 0 since December 2025. Version 6.7 gives her 4 Cryo particles per skill cast. What changed and why it matters.
Xingqiu & Yelan ER: Double Hydro Guide
Double Hydro solves both characters’ energy. Exact ER breakpoints for Xingqiu and Yelan solo and together, with the full math.
Found this guide helpful?
Support future guides and tool updates on Ko-fi.
Optimize Your Team's Energy Recharge
Use ER QuickCalc to calculate precise ER requirements for your team composition.