In my code I have the following variable that I want to display in my log
t_f32 tx_float_to_1x16_send_data[15];
In my cmm script I tried different ways to display my variable but trace32 seems to only manage hex, decimal and binary but not IEEE
PRINT VAR.VALUE(tx_float_to_1x16_send_data[0])
PRINT %Decimal VAR.VALUE(tx_float_to_1x16_send_data[0])
PRINT FORMAT.DECIMAL(8.,VAR.VALUE(tx_float_to_1x16_send_data[0]))
I only found one way to display IEEE but it works with an adress and I don't know how to apply it to a variable
PRINT DATA.FLOAT("IEEE",D:0x800B2C)
Note : when using VAR.VIEW in debug mode, Trace32 is perfectly capable to format the data as a float
Any help would be appreciated.
Thanks
Well, I guess this should work:
PRINT Data.Float("IEEE",Var.ADDRESS(tx_float_to_1x16_send_data[0]))
Related
What does mean and what is used for the expression expression "binary=True" in the following line of code:
w2vmodel = gensim.models.KeyedVectors.load_word2vec_format(
'models/GoogleNews-vectors-negative300.bin.gz'),
binary=True # <-- this
)
The format written by Google's original word2vec.c program had an option to write in plain-text or binary. (Essentially, one wrote floating-point values as human-readable decimal strings, and the other as packed 4-byte binary representations which look like line-noise/strange-characters if viewed as text/characters.)
If you want to read such a file that was written in binary mode, you need to specify binary=True, or else the file format will be misinterpreted, likely failing with errors. There are no other differences in later behavior once the data has been successfully read.
We have a legacy IIS DLL that uses GetServerVariable (MSDN) to retrieve the value of UNENCODED_URL. When accessing the URL:
https://example.com/a%2Fb
the value retrieved will look like this:
/path/to/server.dll/a0.000000b
which is strange, because it should look like this:
/path/to/server.dll/a%2Fb
The LPEXTENSION_CONTROL_BLOCK's value of lpszPathInfo (MSDN) has the value:
/a/b
as expected.
Does anybody know why the UNENCODED_URL value looks like this and how can I retrieve the correct value?
If you’re using for example printf to output the value of the environment variable instead of using a debugger, or puts, that will explain it. %2f will be understood as a command to printf to output the first variable argument as a floating point number.
Always output strings with puts or other functions that do not alter the value.
I have a piece of code(c++) that is writing some floating point values to excel like this:
...
values[ position ].bstrVal = formattedValue;
values[ position ].vt = VT_BSTR;
...
as you can see those floating point values are stored in the form of string and the decimal point is formatted in different ways, for example:
"110.000000", "20.11" etc. (this example is for English locale)
Now it works perfectly when English locale is used. However when I switch to German locale in the Control Panel the decimal point is changed to "," (and that's fine) but after passing those localized strings to Excel they are not correctly converted. For example in case of writing "110,000000" I'm getting 100 millions in excel. Other values like "20,11" stay as a text.
The only way to fix this is to overwrite the decimal point with "." in my program before writing to Excel. Any ideas why the conversion is not locale-aware when using VT_BSTR?
I should also add that I tried to switch the locale in my program from default one to German - still no luck.
Thank you in advance
It is never a good idea to let Excel guess at the value type. Do not use VT_BSTR, a currency value should be of variant type VT_CY. Assign the cyVal member with the value. It is an 8 byte integer value (int64 member of type LONGLONG), the currency amount multiplied by 10,000. Ten thousand :)
Currently, when I print the value of a variable v in GDB (print v) I get an integer.
Is it possible to have GDB print such integer variables in hexadecimal or binary?
Sure it is. Try these:
# Hexadecimal
p/x variable
# Binary
p/t variable
See output formats.
I'm writing a simple tool in Qt which reads data from two GPX (XML) files and combines them in a certain way. I tested my tool with track logs that contain waypoints having 6 decimal digits precision. When I read them from the GPX file, the precision gets reduced to 4 decimal digits (rounded properly). So for example this original tag:
<trkpt lat="61.510656" lon="23.777735">
turns into this when my tool writes it again:
<trkpt lat="61.5107" lon="23.7777">
Debug output shows the precision loss happens on this line:
double lat = in.attributes().value("", "lat").toString().toDouble();
but I can't see why. in is a QXmlStreamReader reading from a text file handle.
It is probably when you are writing the value back to the XML. Please post that code in your question.
If I had a guess before seeing the code, you are using QString::number to convert from the double back to a string. The default precision in the conversion is 6, which corresponds to what you are seeing. You can increase the precision to get all the decimals.