{"id":382,"date":"2010-07-29T14:54:57","date_gmt":"2010-07-29T14:54:57","guid":{"rendered":"https:\/\/ibex.tech\/visualcpp\/?p=382"},"modified":"2022-02-17T06:24:05","modified_gmt":"2022-02-17T06:24:05","slug":"rounding","status":"publish","type":"post","link":"https:\/\/ibex.tech\/visualcpp\/maths\/rounding","title":{"rendered":"Rounding"},"content":{"rendered":"<p>Using this<\/p>\n<pre><code>\r\nint i;\r\nfloat f = 1.53;\r\n\ti = Convert::ToInt32(f);\r\n<\/code><\/pre>\n<p>Will cause i = 2, because Convert::ToInt rounds to the nearest value.  To force rounding down use:<\/p>\n<pre><code>\r\n\ti = Convert::ToInt32((int)f);\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Using this int i; float f = 1.53; i = Convert::ToInt32(f); Will cause i = 2, because Convert::ToInt rounds to the nearest value. To force rounding down use: i = Convert::ToInt32((int)f);<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47],"tags":[],"class_list":["post-382","post","type-post","status-publish","format-standard","hentry","category-maths"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/382","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/comments?post=382"}],"version-history":[{"count":3,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/382\/revisions"}],"predecessor-version":[{"id":1091,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/382\/revisions\/1091"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/media?parent=382"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/categories?post=382"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/tags?post=382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}