LoginLogin

Get Binary of Real Numbers

Root / Programming Questions / [.]

AveryCreated:
For example, storing a 64 bit split into two 32-bit integer items in an array. I'm hoping it could be used for space savings when storing 32 bit numbers and 64 bit numbers together in one file.

I don't think it's possible to do (without using glitches) with full accuracy. If you're trying to save space, it's usually better to just avoid reals completely. It is *technically* possible though.

For example, storing a 64 bit split into two 32-bit integer items in an array. I'm hoping it could be used for space savings when storing 32 bit numbers and 64 bit numbers together in one file.
It would be much faster and easier to expand 32 bit integers into 64 bits and store everything as a float. You might lose space, but unless your dataset is absolutely enormous and over 80% are integers, it won't be that bad. Let's say you have to store 100,000 numbers, and 80% of them are integers. That means you're only wasting 320KB, which really isn't that bad. The overall size would be 800KB, so really, it's not worth your time. 100,000 numbers can store the data for 10 maps of 100x100 each, which is a LOT of map area.

It would be much faster and easier to expand 32 bit integers into 64 bits and store everything as a float. You might lose space, but unless your dataset is absolutely enormous and over 80% are integers, it won't be that bad. Let's say you have to store 100,000 numbers, and 80% of them are integers. That means you're only wasting 320KB, which really isn't that bad. The overall size would be 800KB, so really, it's not worth your time. 100,000 numbers can store the data for 10 maps of 100x100 each, which is a LOT of map area.
I am planning to support an enormous dataset. Multiple files stored together as single file. Program/Text files taking a significant chunk of that. I'm hoping to allow many files to be stored in one file to surpass filesystem restrictions. Long file names, multi-level directories, and random read-write access (if changes aren't saved until the end of the program.)

What, exactly, is your goal? Don't say "save space". To save space, you don't write programs at all - that way, you have saved all the space in memory. You're trying to do something. You think saving space is important, but that is a secondary concern. At a high level, what is it you're trying to do?

ColeslawProductions: I'm tempted to delete your posts because they have little to do with your initial question and fail to actually clarify the goal. Your thread is called "Get Binary of Real Numbers," not "Depressed Rant"

this might be helpful: http://sandbox.mc.edu/~bennet/cs110/flt/dtof.html I'll try to make a thing later maybe.

ColeslawProductions: I'm tempted to delete your posts because they have little to do with your initial question and fail to actually clarify the goal. Your thread is called "Get Binary of Real Numbers," not "Depressed Rant"
I deleted them.

this might be helpful: http://sandbox.mc.edu/~bennet/cs110/flt/dtof.html I'll try to make a thing later maybe.
Thanks

Well, I just reminded myself, for SmileBASIC, 8MB free RAM probably is good enough for most programs when comparing the fact the Commodore 64 only has 64KB of RAM. Another thing to note is that I just did the math and SmileBASIC actually provides 3.5MB VRAM for the graphics pages as well. I shouldn't look at it so limitively. ("Limitively" is a word to me now, deal with it.) Also when comparing the fact the floppy disks typically didn't go above a megabyte for those early computers either.