Hi all.
Is their any way to format floats in JBOX_TRACEVALUES so they appear as:
7.1066905e-05
as opposed to:
0.000007
Thanks,
Murf.
float format in JBOX_TRACEVALUES
-
- RE Developer
- Posts: 1111
- Joined: 03 Jan 2019
Sorry for the long time in responding to this. I have to say that it looks to me that you are introducing floating point inaccuracies by doing it this way, and that you are best off having the correct format at the point of calculation. Can you tell me more about the application, and also whether the intention is to use 32-bit or 64-bit floats, as the example looks very 32 and thus my assumption above.
Cheers,
Brian
-
- RE Developer
- Posts: 670
- Joined: 21 Jun 2019
- Location: Brisbane, Australia
Hi Brian, I am using 64bit floats but this is just for troubleshooting purposes, no risk of lost accuracy in calculations.Enlightenspeed wrote: ↑19 Sep 2023Sorry for the long time in responding to this. I have to say that it looks to me that you are introducing floating point inaccuracies by doing it this way, and that you are best off having the correct format at the point of calculation. Can you tell me more about the application, and also whether the intention is to use 32-bit or 64-bit floats, as the example looks very 32 and thus my assumption above.
Cheers,
Brian
Murf
-
- RE Developer
- Posts: 1111
- Joined: 03 Jan 2019
Ok, well, looking at the SDK we are allowed the following args in JBOX_TRACEVALUES:
const char[] iFile,
TJBox_Int32 iLine,
const char[] iTemplate,
TJBox_Value[] iValues,
TJBox_Int32 iValueCount
A TJBox_Value is an 8-bit Int, so that won't be any use and neither will the Int32's.
So, the obvious choice is to use the 2nd string iTemplate, and set it up with a debug macro method that does the string formatting and returns to a non-local var, and keep that var/s in a debug macro (My own local builds tend to have about 60 or more of these!) You should then be able to pass it into TraceValues.
If you want to use a better string library than the standard C++ stuff, then remember it needs to get commented, or otherwise removed before universal builds.
Hope this is of some use to you,
Cheers,
Brian
-
- RE Developer
- Posts: 484
- Joined: 21 Apr 2016
- Location: Las Vegas
You can always check my small open source project: https://github.com/pongasoft/re-logging
-
- Information
-
Who is online
Users browsing this forum: CommonCrawl [Bot] and 0 guests