bit pattern stored as a float?
BlitzMax Forums/BlitzMax Beginners Area/bit pattern stored as a float?
| ||
Hi, I would like to store an integer value as a float in an array and then get it back from the array to an int. I don't want the integer converted to a float, what I want is the bit pattern to be kept. Is this possible? Jim |
| ||
Simple: no. A conversion to float means it will be saved with lesser precision but higher range. There will always be numbers that change. |
| ||
Strict Local myVertArray#[6] Local myVertColour = $FFAABACA Print Hex$(myVertColour) (Int Ptr(Float Ptr(myVertArray#)))[3] = myVertColour Print myVertArray#[3] myVertColour = (Int Ptr(Float Ptr(myVertArray#)))[3] Print Hex$(myVertColour) |
| ||
If you describe in more detail why you want to do this, we might be able to suggest an alternate method that better suits your needs. |
| ||
Hi, thanks guys, Yan has nailed it. Basically I am keeping things in a Float array mainly and one value in an Intger array. For neatness I wanted the lot to be stored in the float array. Simple as that! Thanks Jim |