Get the name of a number, even if it's stupidly big.
No puede seleccionar más de 25 temas
Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
Este repositorio está archivado. Puede ver los archivos y clonarlo, pero no puede subir cambios o reportar incidencias ni pedir Pull Requests.
|
- import { Digit, GetKiloName } from '../../common'
- import NAMES from './names'
- import getKiloCombiningPrefix from './base/kilo/combiningPrefix'
-
- const getEuropeanLongKiloName: GetKiloName = (thousandPower) => {
- if (thousandPower === 0n) {
- return ''
- }
- if (thousandPower === 1n) {
- return NAMES.thousand
- }
- const kilo = thousandPower
- const kiloHundreds = kilo / 2n / 100n
- const kiloTens = (Number(kilo / 2n / 10n) % 10) as Digit
- const kiloOnes = (Number(kilo / 2n) % 10) as Digit
- const kiloCombiningPrefix = getKiloCombiningPrefix(kiloHundreds, kiloTens, kiloOnes)
-
- return thousandPower % 2n === 0n
- ? kiloCombiningPrefix + NAMES.kiloEvenSuffix
- : kiloCombiningPrefix + NAMES.kiloOddSuffix
- }
-
- export default getEuropeanLongKiloName
|