size of _Float
#1
the wiki says that the size of _Float is 32 bytes, is that correct? https://qb64phoenix.com/qb64wiki/index.p...able_Types
(I know that padding is needed for alignment but the size should be at most 16 bytes)
Reply
#2
(09-09-2022, 02:04 PM)Jack Wrote: the wiki says that the size of _Float is 32 bytes, is that correct? https://qb64phoenix.com/qb64wiki/index.p...able_Types
(I know that padding is needed for alignment but the size should be at most 16 bytes)

It is what it is, and that already since the ancient SDL versions of QB64 more than a decade ago.
Code: (Select All)
DIM f AS _FLOAT
PRINT LEN(f)
Unfortunatly we can't ask the original creator of QB64 about this, as the Wiki says only 10 bytes are used of that 32 bytes, so you may be right nevertheless.
Reply
#3
using a structure of 32 bytes I could rewrite my decfloat routines to give 56 digits vs 19 of _Float
Reply
#4
https://stackoverflow.com/questions/1422...in-c-and-c

(Focus on the top answer in that page.)

It must have been where it came from that "_FLOAT" used only 10-bytes. Otherwise the "long double" in C++ is vague.
Reply
#5
I don't understand why you posted that link, don't see the relevance to this thread
from the time the Intel FPU was introduced the extended type was 80-bits, some compiler makers don't like to implement 80-bit long double so they make long double the same as double
the only thing that I am concerned here is the size, 80-bit = 10 bytes but it needs to be padded for memory alignment, in Windows 32-bit it should be 12 bytes total and in Windows 64-bit it should be 16 bytes total, in Linux I think that it's 16 bytes
Reply
#6
32-bits was chosen for _FLOAT as it was the largest size floating point type in the IEEE 754 specifications.

https://en.wikipedia.org/wiki/IEEE_754

Now, we don't actually use more than a portion of those 256-bits, but Galleon *reserved* the type in case someone ever wanted to expand what we have to have 256-bit floating point precision.

It's oversized by nature to allow for future architecture changes such as the 128 or 256 bit registers coming out on new PCs ten years from now.
Reply
#7
thank you SMcNeill Smile
I hope that you are doing well in your health
Reply
#8
(09-09-2022, 05:27 PM)Jack Wrote: thank you SMcNeill Smile
I hope that you are doing well in your health

We'll find out after Tuesday.  My surgery is finally scheduled and we'll just have to wait until afterwards to see how it all goes.  If all is good, it'll probably be a week or so until AFTER the surgery before you hear back from me.  I'm supposed to be in intensive care for about a week, or so, so I doubt I'll be worried about posting any updates anywhere until I'm out of there at least.  Wink

If you guys don't hear back from me by the end of the month, host a mug in my memory and know it was a pleasure and a blast getting to know all of you and interacting with you all.  Even if the worst imaginable happens and I'm gone, QB64-PE will continue along with the rest of the development team without me.  Smile
Reply
#9
And as far as padding is concerned, you shouldn't need any for _FLOAT.

32-bit data structures are padded on 4-byte chunks. 64-bit data structures are padded on 8-byte chunks. A _FLOAT is 32-bytes and fits perfectly into both those patterns. Just make certain to count 32-bytes for the size, without getting confused over the fact that we're only currently using part of it.
Reply
#10
SMcNeill, about what time is the surgery to take place?
Reply




Users browsing this thread: 2 Guest(s)