Skip to content

Commit

Permalink
changing get_polynome_factors return array order to a logical order
Browse files Browse the repository at this point in the history
  • Loading branch information
Nowres RAFID committed Oct 3, 2011
1 parent 9a85807 commit 091be9e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/polynome.c
Expand Up @@ -89,10 +89,10 @@ double* get_polynome_factors (polynome_t *poly)

factors = malloc ( (poly->order + 1) * sizeof (*factors) );

ptr = factors + poly->order;
ptr = factors;
bal = poly->first;
while ( bal ) {
*(ptr--) = bal->factor;
*(ptr++) = bal->factor;
bal = bal->next;
}
return factors;
Expand Down
2 changes: 1 addition & 1 deletion tests/polynomes-cli/builtins.c
Expand Up @@ -135,7 +135,7 @@ int print (const char* params)
factors = get_polynome_factors (poly->polynome);
printf("%c(%c) = ",poly->name, sym);
while ( fcount ) {
printf("+(%lf) %c^%d ",factors[fcount],sym,--fcount);
printf("+(%lf) %c^%d ",factors[poly->polynome->order - fcount],sym,--fcount);
}
free (factors);
_helper_end_get_params ();
Expand Down

0 comments on commit 091be9e

Please sign in to comment.