[PYTHON] Julia Quick Note [02] Arithmetic formulas, operators

Arithmetic formula, operator (writing example)

note02


◆ Code
 +x ...Positive value
 -x ...Negative value

◆ Four arithmetic operators, etc.
 x + y ...addition
 x - y ...subtraction
 x * y ...multiplication
 x / y ...division
 x ÷ y ...Division quotient(Double-byte character[÷])
 x \ y ...Reciprocal(y /Same as x)
 x ^ y ...Exponentiation
 x % y ...Division remainder(Remainder of division)

◆ Comparison operator
 x == y ...Equivalence operator
 x != y ...Inequivalence operator
 x ≠ y ...Inequivalence operator(Double-byte character[≠])
 x < y ...Lesser operator
 x <= y ...Less than equal operator
 x ≤ y ...Less than equal operator(Double-byte character[≤]* Environment-dependent characters)
 x > y ...Greater operator
 x >= y ...Greater equal operator
 x ≥ y ...Greater equal operator(Double-byte character[≥]* Environment-dependent characters)

◆ Assignment operator
 += ...Addition substitution
 -= ...Subtraction Substitution
 *= ...Multiplication assignment
 /= ...Division assignment
 ÷= ...Dividing quotient substitution(Division quotient)(Double-byte character[÷])
 %= ...Division remainder substitution(Remainder of division)
 ^= ...Exponentiation

◆ Logical operators
 !x ...denial
 ~x ...Bit not
 x & y ...Bit and
 x | y ...Bit or
 x >>> y ...Right logical shift
 x >> y ...Right arithmetic shift
 x << y ...Left logic/Arithmetic shift

Commentary

The feature of operators is that special characters such as [÷] [≠] [≥] [≤] can also be used. Also, exponentiation uses [^], which is different from Python.

Lottery

Julia Quick Look Note [01] How to use variables and constants Julia Quick Look Note [02] Arithmetic Expressions, Operators

(* We will continue to increase the content)

Related information

: paperclip: Julia --Official page https://julialang.org/

: paperclip: Julia --Japanese official document https://julia-doc-ja.readthedocs.io/ja/latest/index.html

: paperclip: First time Julia and installation (Windows & Linux) https://qiita.com/ttlabo/items/b05bb43d06239f968035

:paperclip: Julia - Mathematics https://docs.julialang.org/en/v1/base/math/

Opinions etc.

If you have any opinions or corrections, please let us know.

Recommended Posts

Julia Quick Note [02] Arithmetic formulas, operators
Julia Quick Note [03] Complex Numbers
Julia Quick Note [06] Loop processing
Julia Quick Note [10] Function (2) Application
Julia quick note [05] if statement
Julia Quick Note [04] Regular Expression
Julia Quick Note [09] Function (1) Basics
Julia Quick Note [07] try, catch, finally
[Note] Operators related to four arithmetic operations
Julia Quick Note [22] Calling Python functions and Python modules
Julia Quick Note [01] How to use variables and constants
Julia Quick Note [08] Variable Type (Int, Float, Bool, Char, String)