Use roundf to fix cast to int difference of msys2 w64

This commit is contained in:
Ebrahim Byagowi 2019-09-04 10:59:19 +04:30
parent 88c73359da
commit cad698568a
1 changed files with 7 additions and 7 deletions

View File

@ -142,7 +142,7 @@ main (int argc, char **argv)
double pv;
assert (hb_parse_double (&pp, end, &pv));
assert ((int) (pv * 1000.) == 123);
assert ((int) roundf (pv * 1000.) == 123);
assert (pp - str == 4);
assert (end - pp == 1);
}
@ -154,7 +154,7 @@ main (int argc, char **argv)
double pv;
assert (hb_parse_double (&pp, end, &pv));
assert ((int) (pv * 1000.) == 123);
assert ((int) roundf (pv * 1000.) == 123);
assert (pp - str == 5);
assert (end - pp == 0);
}
@ -166,7 +166,7 @@ main (int argc, char **argv)
double pv;
assert (hb_parse_double (&pp, end, &pv));
assert ((int) (pv * 1000.) == 123);
assert ((int) roundf (pv * 1000.) == 123);
assert (pp - str == 7);
assert (end - pp == 0);
}
@ -178,7 +178,7 @@ main (int argc, char **argv)
double pv;
assert (hb_parse_double (&pp, end, &pv));
assert ((int) (pv * 1000.) == 123);
assert ((int) roundf (pv * 1000.) == 123);
assert (pp - str == 6);
assert (end - pp == 0);
}
@ -190,7 +190,7 @@ main (int argc, char **argv)
double pv;
assert (hb_parse_double (&pp, end, &pv));
assert ((int) (pv * 1000.) == 123);
assert ((int) roundf (pv * 1000.) == 123);
assert (pp - str == 10);
assert (end - pp == 0);
}
@ -202,7 +202,7 @@ main (int argc, char **argv)
double pv;
assert (hb_parse_double (&pp, end, &pv));
assert ((int) (pv * 1000.) == -123);
assert ((int) roundf (pv * 1000.) == -123);
assert (pp - str == 13);
assert (end - pp == 0);
}
@ -214,7 +214,7 @@ main (int argc, char **argv)
double pv;
assert (hb_parse_double (&pp, end, &pv));
assert ((int) (pv * 1000.) == -123);
assert ((int) roundf (pv * 1000.) == -123);
assert (pp - str == 8);
assert (end - pp == 0);
}