0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

負の数の剰余演算(mod)がイメージしづらい方へ

Last updated at Posted at 2025-03-07

glsln学習中に負の数の剰余演算がイメージできなかったので例えを考えました。

「借金返済の過払い金」 です。

mod(a, b)とした際に、aを借金額、bを毎月の返済金額と考えます。
例えばmod(-10.2, 1.0)だと、102,000円借金している状態で毎月固定で10,000円ずつ返済していきます。
110,000円払った時に8,000円の過払い金が発生するため、答えは0.8といったイメージです。

誰かの助けになれば幸いです😇

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?