Repository: symfony/symfony
File: src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php (PHP)

Code before:
        [$highBits32, $lowBits32] = $pair;

        // Recompose a 64-bit unsigned integer from two 32-bit chunks.
        $unsigned64 = ((($highBits32 & 0xFFFFFFFF) << 32) | ($lowBits32 & 0xFFFFFFFF));

        // Convert to signed 64-bit (two's complement) if sign bit is set.
        if ($unsigned64 >= (1 << 63)) {
            $unsigned64 -= (1 << 64);
        }

        // Split into seconds and milliseconds.
        $seconds = intdiv($unsigned64, 1000);
        $millisecondsRemainder = $unsigned64 - $seconds * 1000;

        // Normalize negative millisecond remainders (e.g., for pre-1970 values)
        if (0 > $millisecondsRemainder) {
            $millisecondsRemainder += 1000;

            --$seconds;
        }

        // Build "U.u" string (seconds.microseconds). Pad ms to 3 digits, then add 000 to get microseconds.
        $epochWithMicros = \sprintf('%d.%03d000', $seconds, $millisecondsRemainder);

        $datetime = \DateTimeImmutable::createFromFormat(
            'U.u',
            $epochWithMicros,
            new \DateTimeZone('UTC'),
        );

        if (false === $datetime) {
            throw new \RuntimeException('Unable to parse ICU milliseconds pair.');
        }

        return $datetime->format('Y-m-d');
    }

    protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
    {
        return $scanner->scanLocales($sourceDir.'/curr');
    }

    protected function compileTemporaryBundles(BundleCompilerInterface $compiler, string $sourceDir, string $tempDir): void
    {
        $compiler->compile($sourceDir.'/curr', $tempDir);
        $compiler->compile($sourceDir.'/misc/currencyNumericCodes.txt', $tempDir);
    }

    protected function preGenerate(): void
    {
        $this->currencyCodes = [];

Review comment (refactor):
let's simplify this and remove the part about $millisecondsRemainder
in the end we have only day precision

Code after:
    protected function preGenerate(): void
    {
        $this->currencyCodes = [];
    }

    protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
    {
        $localeBundle = $reader->read($tempDir, $displayLocale);

        if (isset($localeBundle['Currencies']) && null !== $localeBundle['Currencies']) {
            $data = [
                'Names' => $this->generateSymbolNamePairs($localeBundle),
            ];

            $this->currencyCodes = array_merge($this->currencyCodes, array_keys($data['Names']));

            return $data;
        }

        return null;
    }

    protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array
    {
        $rootBundle = $reader->read($tempDir, 'root');

        return [
            'Names' => $this->generateSymbolNamePairs($rootBundle),
        ];
    }

    protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
    {
        $supplementalDataBundle = $reader->read($tempDir, 'supplementalData');
        $numericCodesBundle = $reader->read($tempDir, 'currencyNumericCodes');

        $this->currencyCodes = array_unique($this->currencyCodes);

        sort($this->currencyCodes);

        $data = [
            'Currencies' => $this->currencyCodes,
            'Meta' => $this->generateCurrencyMeta($supplementalDataBundle),
            'Map' => $this->generateCurrencyMap($supplementalDataBundle),
            'Alpha3ToNumeric' => $this->generateAlpha3ToNumericMapping($numericCodesBundle, $this->currencyCodes),
        ];

        $data['NumericToAlpha3'] = $this->generateNumericToAlpha3Mapping($data['Alpha3ToNumeric']);

        return $data;
    }