bugfix: ' floating point exception' due wrongly placed code
while integrating the old 'getSqrt()' function into the 'bsqrt()' function i misplaced some code. this lead to 'r' being 0 on the first run. doh.
This commit is contained in:
parent
b530c14051
commit
ae7a54a4b6
1 changed files with 2 additions and 1 deletions
|
@ -76,9 +76,10 @@ unsigned long bsqrt(unsigned int x) {
|
||||||
sqrt_table[0] = 0;
|
sqrt_table[0] = 0;
|
||||||
sqrt_table[1] = 1;
|
sqrt_table[1] = 1;
|
||||||
|
|
||||||
unsigned long r = x >> 1;
|
unsigned long r;
|
||||||
unsigned long q;
|
unsigned long q;
|
||||||
for (x = 2; x < SQRT_TABLE_ENTRIES; x++) {
|
for (x = 2; x < SQRT_TABLE_ENTRIES; x++) {
|
||||||
|
r = x >> 1;
|
||||||
while (1) {
|
while (1) {
|
||||||
q = x / r;
|
q = x / r;
|
||||||
if (q >= r) {
|
if (q >= r) {
|
||||||
|
|
Loading…
Reference in a new issue