PennMUSH Community

Ticket #7664 (closed bug: wontfix)

Opened 3 months ago

Last modified 1 month ago

baseconv() will not convert 32 bit numbers

Reported by: Trelane Assigned to:
Priority: minor Milestone:
Keywords: baseconv, baseconv() Cc:
Visibility: Public

Description

baseconv() does not convert 32 bit numbers.

THINK baseconv(2147483647,10,2) returns correctly: 1111111111111111111111111111111 THINK baseconv(2147483648,10,2) returns the same, however. (Theoretically it should return 10000000000000000000000000000000)

It's not a major problem, but slightly annoying. Very easy to work around as far as softcode goes, but a bug nonetheless, I think. (I could be mistaken; it was suggested that the 32nd bit is used for the sign--ie -2147483647 is a 32 bit number)

Change History

09/11/08 20:53:09 changed by raevnos

  • status changed from new to closed.
  • resolution set to wontfix.

2147483647 is the largest value that can be stored in a signed 32 bit int, which baseconv() uses internally. 2147483648 ends up overflowing it. (With the recent change Walker made to baseconv(), your second example returns 0.)

This should probably be documented, or we should consider using 64-bit integer math...