- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all:
When the floating point is set to exact mode,
The debugging result is as follows, and the value cannot be calculated and displayed normally.
Solved! Go to Solution.
- Tags:
- Floating-point
- printf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Hongli,
From your debug window, the pcg has correct value, is it right?
When you are using UART monitor, what is processed for pcg?
i.e.
pcg = {...}
calc(pcg);
printf(pcg);
dw
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi dw, thank you for your reply.
Regarding the PCG value of the debug window, later debugging found that this value is not correct. The "sqrt ()" function is not executed during the project, which means that the square root of the variable does not change its value.
The value displayed in the debug window is the final value to be displayed without any processing, as shown in the picture below.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
https://resources.tasking.com/sites/default/files/uberflip_docs/file_254.pdf
Please refer to above user manual page 639 for description.
I used fp-model=1 (precise) and do a simple sqrt, it's like above showed.
My Tasking path is:
C:\Program Files\TASKING\TriCore v6.3r1\ctc
dw
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My Settings are the same as yours: fp-model=1 (precise)
But I got a different result here.
When debug sets a breakpoint at line 75, run to the breakpoint and see the variable 'res', which is not assigned.
I used AURIX Development Studio1.6 and MCU is SAK-TC297TX-128. I hope you can help me solve this problem. Thank you very much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Hongli
Please use global variable instead, then add it into Expressions Window.
dw
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi dw
The running result is shown in the following figure.
Hongli
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi HOngli,
Could you please try -lc_fpu and fp-model=1 ?
dw
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi dw,
According to what you said -lc_fpu and fp-model=1
Amazingly, I got the right number. Can you tell me the general reason? I'd appreciate it.
Hongli
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please refer to above Tasking user manual for chapter 7.3. Linking with Libraries
If you use single precise floating, then link libcs_fpu.a. otherwise, link libc_fpu.a
-lc_fpu is with -fpmodel =1 and -lcs_fpu is with -fpmodel=3
You could try this combination.
dw