This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

55
cppdraft/expr/mul.md Normal file
View File

@@ -0,0 +1,55 @@
[expr.mul]
# 7 Expressions [[expr]](./#expr)
## 7.6 Compound expressions [[expr.compound]](expr.compound#expr.mul)
### 7.6.5 Multiplicative operators [expr.mul]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L7059)
The multiplicative operators *, /, and % group
left-to-right[.](#1.sentence-1)
[multiplicative-expression:](#nt:multiplicative-expression "7.6.5Multiplicative operators[expr.mul]")
[*pm-expression*](expr.mptr.oper#nt:pm-expression "7.6.4Pointer-to-member operators[expr.mptr.oper]")
[*multiplicative-expression*](#nt:multiplicative-expression "7.6.5Multiplicative operators[expr.mul]") * [*pm-expression*](expr.mptr.oper#nt:pm-expression "7.6.4Pointer-to-member operators[expr.mptr.oper]")
[*multiplicative-expression*](#nt:multiplicative-expression "7.6.5Multiplicative operators[expr.mul]") / [*pm-expression*](expr.mptr.oper#nt:pm-expression "7.6.4Pointer-to-member operators[expr.mptr.oper]")
[*multiplicative-expression*](#nt:multiplicative-expression "7.6.5Multiplicative operators[expr.mul]") % [*pm-expression*](expr.mptr.oper#nt:pm-expression "7.6.4Pointer-to-member operators[expr.mptr.oper]")
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L7079)
The operands of * and / shall have arithmetic or unscoped
enumeration type; the operands of % shall have integral or unscoped
enumeration type[.](#2.sentence-1)
The [usual arithmetic conversions](expr.arith.conv "7.4Usual arithmetic conversions[expr.arith.conv]") are performed on the
operands and determine the type of the result[.](#2.sentence-2)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L7085)
The binary * operator indicates multiplication[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L7088)
The binary / operator yields the quotient, and the binary% operator yields the remainder from the division of the first
expression by the second[.](#4.sentence-1)
If the second operand of / or % is zero, the behavior is
undefined[.](#4.sentence-2)
For integral operands, the / operator yields the algebraic quotient with
any fractional part discarded;[63](#footnote-63 "This is often called truncation towards zero.") if the quotient a/b is representable in the type of the result,(a/b)*b + a%b is equal to a; otherwise, the behavior
of both a/b and a%b is undefined[.](#4.sentence-3)
[63)](#footnote-63)[63)](#footnoteref-63)
This is often called truncation towards zero[.](#footnote-63.sentence-1)