Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Quick programming question
#6
I think your questions are better asked and answered on a TI developer forum, but I'll try my best...

2147483647 Wrote:Sorry. I didn't really understand that article. Here are the tables:


FormatBarsPixelsTotal
A/B206166
AB^-1282226



FormatBarsPixelsTotal
1/B, when B=1150120
B^-1, when B=1141113
1/B, when B=pi202162
B^-1, when B=pi192154


How come in the first table, ^-1 worked really slowly, but in the second, it worked faster?
Truthfully, I don't know. It all depends on TI's compiler and the CPU architecture. But the best I can think of is:
  • In Table 1, case 2: the compiler/CPU is thinking of it as two operations going on instead of just one (e.g., take inverse of B -> now multiply A and B's inverse).

2147483647 Wrote:Also, it's probably not the case, but what if A=1 in the first table?
Again, I don't know. This is something you should actually test. It's possible that it will run slower because it needs to access the variable in memory -- there is going to be some kind of overhead for using a variable instead of a constant. I think it would take a lot of loops to cause a significant real world impact on performance though.

2147483647 Wrote:I thought in a complex equation, the program groups each portion as a separate entity. How else would it account for operations grouped together with parentheses, like in the following example:

A(X+Y)^-1
Yes, it should apply order of operations correctly. 1) X+Y, 2) take the inverse of the result of 1, and 3) A multiplied by the result of 2.
Reply


Messages In This Thread
Quick programming question - by 2147483647 - 2010-08-15, 11:24 PM
Quick programming question - by Eos - 2010-08-15, 11:28 PM
Quick programming question - by 2147483647 - 2010-08-15, 11:36 PM
Quick programming question - by singularity - 2010-08-16, 05:42 AM
Quick programming question - by 2147483647 - 2010-08-16, 05:52 AM
Quick programming question - by singularity - 2010-08-16, 07:40 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)