- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
In the US, the Zip Code was originally a 5 digit number indicating which postal station to send the mail to. That can be "efficiently" stored in a 64-bit integer; an unsigned 32-bit integer only goes up to 65535, so unless you are restricting all addresses to exclude the western states, it would not do. 64-bit integer uses 8 bytes. A 5-character string stores in 6 bytes (5 characters, plus either a length byte or a terminating null character, depending on the language). It could be up to 19 bytes (8 byte pointer, 1-byte length, 5*2-byte Unicode characters) or more, again depending on the language. So clearly, storing a zip code in a Long is the correct way to do this. At least until you try to send mail to Canada or Britain or any other country that include letters in their postal codes.
For over a decade, the USPS has been using Zip+4 Code, which not only tells them which postal station to send the mail to, but also where in the area serviced by the postal station to deliver the mail. e.g. 00112-4130. It really is time to convert this to a string. It has been for a while.
Admin
do U also try to reassign π in those scripts? i and j are set to sqrt( -1) for a good reason in them.
Admin
FYI, if you ever need to deal with this kind of thing ... pray that your language supports anonymous unions.