Last active
September 6, 2017 15:36
-
-
Save meijeru/94a9b3a2fb131a4011e24b1e9fde561b to your computer and use it in GitHub Desktop.
Types of artihmetic operations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Updated to Red for Windows version 0.6.2 built 7-Jun-2017/15:13:57+2:00 | |
The table gives type of first operand, type of second operand, result type | |
for + (add), - (subtract), * (multiply), / (divide), // (modulo) and % (remainder) | |
For vectors, the element type is distinguished. | |
There is one case (time with time) where the result type is not the same | |
for all allowed operations. | |
After each type combination, the reverse combination is given. | |
The fourth column gives the operators for which the combination is forbidden. | |
If the result type is error, the combination is forbidden for all operators. | |
The order of types is: char integer float percent pair tuple vector (of char etc.) | |
type 1 type 2 result type except for | |
char char char // | |
char integer char // | |
integer char integer // | |
char float char // | |
float char float // | |
char percent error | |
percent char error | |
char time error | |
time char error | |
char pair error | |
pair char error | |
char tuple error | |
tuple char error | |
char vector char error | |
vector char char error | |
char vector integer error | |
vector integer char error | |
char vector float error | |
vector float char error | |
char vector percent error | |
vector percent char error | |
integer integer integer | |
integer float float | |
float integer float | |
integer percent float | |
percent integer percent | |
integer time time | |
time integer time | |
integer pair pair / // | |
pair integer pair // | |
integer tuple tuple - / // | |
tuple integer tuple // | |
integer vector char error | |
vector char integer vector char // | |
integer vector integer error | |
vector integer integer vector integer // | |
integer vector float error | |
vector float integer vector float // | |
integer vector percent error | |
vector percent integer vector percent // | |
float float float | |
float percent float | |
percent float percent | |
float time time | |
time float time | |
float pair pair / // | |
pair float pair // | |
float tuple tuple - / // | |
tuple float tuple // | |
float vector char error | |
vector char float vector char // | |
float vector integer error | |
vector integer float vector integer // | |
float vector float error | |
vector float float vector float // | |
float vector percent error | |
vector percent float vector percent // | |
percent percent percent | |
percent time time | |
time percent time | |
percent pair pair / // | |
pair percent pair // | |
percent tuple tuple - / // | |
tuple percent tuple // | |
percent vector char error | |
vector char percent vector char // | |
percent vector integer error | |
vector integer percent vector integer // | |
percent vector float error | |
vector float percent vector float // | |
percent vector percent error | |
vector percent percent vector percent // | |
time + - // % time time | |
time / time float | |
time * time error | |
time pair error | |
pair time error | |
time tuple error | |
tuple time error | |
time vector char error | |
vector char time error | |
time vector integer error | |
vector integer time error | |
time vector float error | |
vector float time error | |
time vector percent error | |
vector percent time error | |
pair pair pair // | |
pair tuple error | |
tuple pair error | |
pair vector char error | |
vector char pair error | |
pair vector integer error | |
vector integer pair error | |
pair vector float error | |
vector float pair error | |
pair vector percent error | |
vector percent pair error | |
tuple tuple tuple // | |
tuple vector char error | |
vector char tuple error | |
tuple vector integer error | |
vector integer tuple error | |
tuple vector float error | |
vector float tuple error | |
tuple vector percent error | |
vector percent tuple error | |
vector char vector char vector char // | |
vector char vector integer error | |
vector integer vector char error | |
vector char vector float error | |
vector float vector char error | |
vector char vector percent error | |
vector percent vector char error | |
vector integer vector integer vector integer // | |
vector integer vector float error | |
vector float vector integer error | |
vector integer vector percent error | |
vector percent vector integer error | |
vector float vector float vector float // | |
vector float vector percent error | |
vector percent vector float error | |
vector percent vector percent vector percent // |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment