This commit is contained in:
DBotThePony 2022-09-04 16:17:06 +07:00
parent c25d8729c2
commit b010bcdd5d
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -587,7 +587,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do
*/ */
fun valueOf(value: Int): ImpreciseFraction { fun valueOf(value: Int): ImpreciseFraction {
if (value in -1024 .. 1024) { if (value in -1024 .. 1024) {
return cache[value + 128] return cache[value + 1024]
} }
return ImpreciseFraction(value) return ImpreciseFraction(value)
@ -598,7 +598,7 @@ class ImpreciseFraction @JvmOverloads constructor(whole: BigInteger, decimal: Do
*/ */
fun valueOf(value: Long): ImpreciseFraction { fun valueOf(value: Long): ImpreciseFraction {
if (value in -1024L .. 1024L) { if (value in -1024L .. 1024L) {
return cache[value.toInt()] return cache[value.toInt() + 1024]
} }
return ImpreciseFraction(value) return ImpreciseFraction(value)