File tree 4 files changed +5
-5
lines changed
4 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -613,7 +613,7 @@ <h2 id="_3">地板除与天花板除</h2>
613
613
< p > 等价于</ p >
614
614
< pre > < code class ="language-cpp "> int c = floor((float)a / b); // c = floor(2.8) = 2
615
615
</ code > </ pre >
616
- < p > 如果 < code > a</ code > 除以 < code > b</ code > 除不尽,那么会找到比他大的第一个整数作为结果 ,这就是< strong > 地板除 (floor div)</ strong > 。</ p >
616
+ < p > 如果 < code > a</ code > 除以 < code > b</ code > 除不尽,那么会找到比他小的第一个整数作为结果 ,这就是< strong > 地板除 (floor div)</ strong > 。</ p >
617
617
< p > C 语言默认的就是地板除。</ p >
618
618
< p > 如果我想要的是向上取整,该怎么写?</ p >
619
619
< p > 最原始的写法是先转成浮点数来除,然后ceil函数向上取整:</ p >
Original file line number Diff line number Diff line change @@ -292,7 +292,7 @@ <h2 id="_1">前言</h2>
292
292
< blockquote >
293
293
< p > < img src ="./img/bulb.png " height ="30px " width ="auto " style ="margin: 0; border: none "/> 本书还在持续更新中……要追番的话,可以在 < a href ="https://github.com/parallel101/cppguidebook "> GitHub</ a > 点一下右上角的 “Watch” 按钮,每当小彭老师提交新 commit,GitHub 会向你发送一封电子邮件,提醒你小彭老师更新了。</ p >
294
294
</ blockquote >
295
- < p > 更新时间:2024年11月09日 11:37:54 (UTC+08:00)</ p >
295
+ < p > 更新时间:2024年11月09日 11:39:40 (UTC+08:00)</ p >
296
296
< p > < a href ="https://parallel101.github.io/cppguidebook "> 在 GitHub Pages 浏览本书</ a > | < a href ="https://142857.red/book "> 在小彭老师自己维护的镜像上浏览本书</ a > </ p >
297
297
< h2 id ="_2 "> 格式约定</ h2 >
298
298
< blockquote >
Original file line number Diff line number Diff line change @@ -421,7 +421,7 @@ <h2 id="index-_1">前言</h2>
421
421
<blockquote>
422
422
<p><img src="../img/bulb.png" height="30px" width="auto" style="margin: 0; border: none"/> 本书还在持续更新中……要追番的话,可以在 <a href="https://github.com/parallel101/cppguidebook">GitHub</a> 点一下右上角的 “Watch” 按钮,每当小彭老师提交新 commit,GitHub 会向你发送一封电子邮件,提醒你小彭老师更新了。</p>
423
423
</blockquote>
424
- <p>更新时间:2024年11月09日 11:37:54 (UTC+08:00)</p>
424
+ <p>更新时间:2024年11月09日 11:39:40 (UTC+08:00)</p>
425
425
<p><a href="https://parallel101.github.io/cppguidebook">在 GitHub Pages 浏览本书</a> | <a href="https://142857.red/book">在小彭老师自己维护的镜像上浏览本书</a></p>
426
426
<h2 id="index-_2">格式约定</h2>
427
427
<blockquote>
@@ -1241,7 +1241,7 @@ <h2 id="cpp_tricks-_3">地板除与天花板除</h2>
1241
1241
<p>等价于</p>
1242
1242
<pre><code class="language-cpp">int c = floor((float)a / b); // c = floor(2.8) = 2
1243
1243
</code></pre>
1244
- <p>如果 <code>a</code> 除以 <code>b</code> 除不尽,那么会找到比他大的第一个整数作为结果 ,这就是<strong>地板除 (floor div)</strong>。</p>
1244
+ <p>如果 <code>a</code> 除以 <code>b</code> 除不尽,那么会找到比他小的第一个整数作为结果 ,这就是<strong>地板除 (floor div)</strong>。</p>
1245
1245
<p>C 语言默认的就是地板除。</p>
1246
1246
<p>如果我想要的是向上取整,该怎么写?</p>
1247
1247
<p>最原始的写法是先转成浮点数来除,然后ceil函数向上取整:</p>
Load Diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments