|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Square Root Function not working
Why isn't this working? I always get a value that's too high. 4 would give me the correct value, but 9 up always goes over. It's kind of weird too, every perfect square makes it go over a little less, you can check it out and see what I mean.
Code:
float sqrt(unsigned int tar, float accr)
{
float i;
for (i=0.0f;i<tar;i+=accr)
{
if (i*i >= tar)
return i;
}
}
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mulit-postioning with pnuematics this year? | KenWittlief | Pneumatics | 101 | 01-02-2005 21:54 |
| Square Root | bludstayne | Programming | 3 | 14-02-2004 14:48 |
| Aspartame | shyra1353 | Chit-Chat | 8 | 20-01-2004 22:41 |
| I'm working :) | Jack | FIRST Scouting Network | 2 | 03-01-2004 01:26 |
| Whose working this summer? | Frank(Aflak) | Chit-Chat | 20 | 28-05-2003 11:35 |