<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>kikiki-kiki</author_name>
  <author_url>https://blog.hatena.ne.jp/kikiki-kiki/</author_url>
  <blog_title>かもメモ</blog_title>
  <blog_url>https://chaika.hatenablog.com/</blog_url>
  <categories>
    <anon>JavaScript</anon>
    <anon>TypeScript</anon>
  </categories>
  <description>与えられた数値を 0, 5, 10, 15, … と 5刻みに丸めたい 結論 const get5RoundNumber = (n: number) =&gt; Math.round(n * 2 / 10) * 10 / 2; 5 刻みの数値を得るには 10 刻み 0, 10, 20, 30, ... を 2 で割れば 0, 5, 10, 15, … ととなる 0, 10, 20, 30,… という数字を得るには、四捨五入で 0, 1, 2, 3,... を作り 10 倍すれば良い 最終的に 2 で割るので、もとの数値を 2倍しておく 1の位で四捨五入するには 1の位を小数点第一位にするために、10…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fchaika.hatenablog.com%2Fentry%2F2024%2F07%2F08%2F083000&quot; title=&quot;JavaScript 5刻みの数値に変換したい - かもメモ&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://m.media-amazon.com/images/I/61Z8lOjXtfL._SL500_.jpg</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2024-07-08 08:30:00</published>
  <title>JavaScript 5刻みの数値に変換したい</title>
  <type>rich</type>
  <url>https://chaika.hatenablog.com/entry/2024/07/08/083000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
