Skip to content

Commit

Permalink
Round toward zero when converting bytes from float to int
Browse files Browse the repository at this point in the history
Otherwise we get things like int(1024.6) = 1025 because rounding to nearest (in
the binary representation) rounds like that.
  • Loading branch information
vpodzime committed Oct 23, 2015
1 parent 11da8f6 commit 60d48d7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/bs_size.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ BSSize* bs_size_new_from_str (const gchar *size_str, GError **error) {
}

ret = bs_size_new ();
mpfr_get_z (ret->priv->bytes, size, MPFR_RNDN);
mpfr_get_z (ret->priv->bytes, size, MPFR_RNDZ);

g_free (loc_size_str);
g_match_info_free (match_info);
Expand Down

0 comments on commit 60d48d7

Please sign in to comment.