Indeed, doing the math outside does the trick (why??):
PRINT is about the world's most complicated set of code. The code to launch nuclear missiles can't be much more complex than PRINT is. There's a ton of things which it does wonky, but they're hard to sort out to try and fix.
In this case, let's look at your QB64 code and the translated C-code which we make from it:
QB64 code:
Translated code:
qbs_set(tqbs,qbs_add(qbs_add(qbs_add(qbs_str((double)(floor(*__INTEGER64_SIZEDONE/ 107374182.4E+0 )/ 10 )),qbs_new_txt_len(" GB (",5)),qbs_ltrim(qbs_str((long double)(floor(*__INTEGER64_SIZEDONE/ ((long double)(*__INTEGER64_ALLFOLDERSTOTAL))* 100 ))))),qbs_new_txt_len("%)",2)));
Isn't that a nice a simple little line of code to try and sort out?? And which part of that is causing the issue with the math itself is in there somewhere.... But where?
My first guess would be at asking, "Why is the first math cast to a double, while the rest is to long doubles? (See the (double) vs the (long double)?)
My second question is: If we were to change that to long double for testing, exactly where in the QB64 source would we make that change with the translation??? (And from my past experience with PRINT here, my answer would probably be, "We don't. We hide from trying to sort out PRINT issues and leave them to someone else to figure out!!")