5211 w/ CW6.4 - math issues

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

5211 w/ CW6.4 - math issues

1,955 Views
Toe
Contributor IV
I'm trying to perform a log on a float, but the return value is bogus.  I've searched through this forum and have seen this issue posted before without any closure.

I'm using the following libraries: C_4i_CF_Runtime.a, fp_coldfire.a, and C_4i_CF_MSL.a

The code compiles, links and executes fine.

the source:
t3 = (float)logf(t2);                       // ln(t2);

the assembler:
0000592C: 202EFFF0        move.l   -16(a6),d0
00005930: 2F400004        move.l   d0,4(a7)
00005934: 41EEFFF8        lea      -8(a6),a0
00005938: 2E88            move.l   a0,(a7)
0000593A: 4EB9000098F4    jsr      .vectors + 0x00000000 (0x000098F4) (0x98f4); 0x000098f4
00005940: 2D48FFBC        move.l   a0,-68(a6)
00005944: 206EFFBC        movea.l  -68(a6),a0
00005948: 2010            move.l   (a0),d0
0000594A: 22280004        move.l   4(a0),d1
0000594E: 2F410004        move.l   d1,4(a7)
00005952: 2E80            move.l   d0,(a7)
00005954: 4EB900009D4C    jsr      _logf (0x9d4c)          ; 0x00009d4c
0000595A: 2D40FFD8        move.l   d0,-40(a6)
0000595E: 202EFFD8        move.l   -40(a6),d0
00005962: 2E80            move.l   d0,(a7)
00005964: 4EB900009C54    jsr      .vectors + 0x00000070 (0x00009C54) (0x9c54); 0x00009c54
0000596A: 2D40FFB8        move.l   d0,-72(a6)
0000596E: 202EFFB8        move.l   -72(a6),d0
00005972: 2D40FFEC        move.l   d0,-20(a6)

log, logf, log10, etc...  none of these work correctly.
Labels (1)
0 Kudos
3 Replies

282 Views
Toe
Contributor IV
Wow, ok I figured out what I needed to do.  I created a project based off of the 5213evb project and saw some unexpected errors spit out to the console whenever I tried to take the log of something.  After a bit more searching I found this thread:
http://forums.freescale.com/freescale/board/message?board.id=CWCFCOMM&message.id=763&query.id=180990...

I followed some directions to modify the ansi prefix file and recompile the libraries.  After doing this log, log10, etc worked correctly.


0 Kudos

282 Views
Toe
Contributor IV
I double checked just to make sure, but the vars are definitely floats.
0 Kudos

282 Views
Technoman64
Contributor III
Do you have t2 decalred as float?
 
I have ran into issues when using integers.
 
 
0 Kudos