If "Num" has also a limit, then, perhaps, a lookup table would do the best performance. If not, as I can see, there shoud be sets of x, y and z values for the same "Num", so there must be some sort of preferences among the possible solutions, so which can they be? Francisco Niklas Lvvgren wrote: >Have you tried exhaustive search ? ie go thru all x,y,z from 0 to 255 >and see if you find a match. If you could take that it's slow this should >work! >Note though it's slow (worst case several seconds) and it's a pretty >"stupid" >algorithm. Maybe it's possible to apply some shortcuts in it that will >improve >performance! > >/niklo > >-----Ursprungligt meddelande----- >Fren: Thomas N [mailto:thomasn101@HOTMAIL.COM] >Skickat: den 8 juli 2002 09:13 >Till: PICLIST@MITVMA.MIT.EDU >Dmne: Fw: C Question. Please help! > > >One more thing: The maximum values for variable x, y, and z is 256 >Thanks! >Thomas >----- Original Message ----- >From: "Thomas N" >To: "pic microcontroller discussion list" >Sent: Monday, July 08, 2002 12:10 AM >Subject: [OT]: C Question. Please help! > > > > >>Hello everyone, >> >>How to I search for x, y, and z variables in the equation below to get the >>answer that's closest to Num variable using C language? >> >>Num = x * ( y * (3*z + 4) + 4) + 18 >> >>For example, if num = 122. The answer for x is 2, y is 3, z is 4. >> >>Best regards, >>Thomas >> >> >> > >-- >http://www.piclist.com hint: The PICList is archived three different >ways. See http://www.piclist.com/#archives for details. > >-- >http://www.piclist.com hint: The PICList is archived three different >ways. See http://www.piclist.com/#archives for details. > > > > > > > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu