Skip to content

Commit

Permalink
add test for modf negatives
Browse files Browse the repository at this point in the history
  • Loading branch information
kripken committed Aug 20, 2014
1 parent 392e7ff commit 4805247
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 12 additions & 0 deletions tests/core/test_rounding.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,17 @@ int main() {
printf("%ld ", lrint(-1.5));
printf("%ld ", lrint(-2.5));

printf("\n");

double param, fractpart, intpart;

param = 3.14159265;
fractpart = modf (param , &intpart);
printf ("%f = %f + %f \n", param, intpart, fractpart);

param = -3.14159265;
fractpart = modf (param , &intpart);
printf ("%f = %f + %f \n", param, intpart, fractpart);

return 0;
}
4 changes: 3 additions & 1 deletion tests/core/test_rounding.out
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
1.0 2.0 -1.0 -2.0 2.0 3.0 -2.0 -3.0 1 2 -1 -2 2 2 -2 -2
1.0 2.0 -1.0 -2.0 2.0 3.0 -2.0 -3.0 1 2 -1 -2 2 2 -2 -2
3.141593 = 3.000000 + 0.141593
-3.141593 = -3.000000 + -0.141593

0 comments on commit 4805247

Please sign in to comment.