diff --git a/README.md b/README.md index 78e3799..8eb2a7f 100644 --- a/README.md +++ b/README.md @@ -296,7 +296,7 @@ import { stringToBigInt } from "k-number-utils" // Basic ASCII string - returns BigIntCoercion instance const hello = stringToBigInt("hello") hello.toBigInt() // 448378203247n -hello.toInt32() // 1818522991 +hello.toInt32() // 1701604463 hello.toUint8() // 111 (lower 8 bits) // Single character @@ -312,8 +312,8 @@ stringToBigInt("🚀").toBigInt() // 4036991616n stringToBigInt("🚀").toInt32() // -257975680 // Chinese characters -stringToBigInt("你好").toBigInt() // 15060223084n -stringToBigInt("你好").toChar() // '好' (lower 16 bits) +stringToBigInt("你好").toBigInt() // 251503099356605n +stringToBigInt("你好").toChar() // 'ꖽ' (lower 16 bits) // Mixed content const mixed = stringToBigInt("Hello 🌍") diff --git a/src/bigint-coercion.ts b/src/bigint-coercion.ts index 040e420..a0e67d1 100644 --- a/src/bigint-coercion.ts +++ b/src/bigint-coercion.ts @@ -10,7 +10,7 @@ * const bn = new BigIntCoercion(123456789n); * bn.toInt32(); // 123456789 * bn.toUint8(); // 21 (truncated to 8 bits) - * bn.toChar(); // 'Í' (Unicode character from lower 16 bits) + * bn.toChar(); // '촕' (Unicode character from lower 16 bits) * * @example * // Collision example - large values wrap around @@ -242,7 +242,7 @@ export class BigIntCoercion { * @example * new BigIntCoercion(65n).toChar(); // 'A' * new BigIntCoercion(8364n).toChar(); // '€' (Euro sign) - * new BigIntCoercion(128512n).toChar(); // '😀' (would wrap to 16 bits) + * new BigIntCoercion(128512n).toChar(); // '' (wraps to 16 bits: 62976) */ toChar(): string { const codePoint = this.toUint16()