Sponsor
Like this page 1
Like this page 2
Click Here!
Join & Earn
I am Here!
Huge Money
Earn Money
Earn By Posing
2 cent Per Post
Earn by typing
Click Here!
Search Engine
Promote and earn
User Who get the master Card
Click Here!
Rules for eligible
Ved International
General Rules
Payment proof 1
Happy Moment
Job Discussion
Fantastic Ved
Earn By Posing
I am Here!
Huge Money
Earn Money
Earn By Posing
2 cent Per Post
Earn by typing
Click Here!
Search Engine
Promote and earn
User Who get the master Card
Click Here!
Rules for eligible
Ved International
General Rules
Payment proof 1
Happy Moment
Job Discussion
Fantastic Ved
Earn By Posing
Earn by typing
Click Here!
Search Engine
Promote and earn
User Who get the master Card
Click Here!
Rules for eligible
Ved International
General Rules
Payment proof 1
Happy Moment
Job Discussion
Fantastic Ved
Earn By Posing
Social bookmarking
Bookmark and share the address of Ved International Discussion Board on your social bookmarking website
Top posting users this month
No user |
Most active topic starters
jesus | ||||
blackroseshrestha | ||||
oshen011 | ||||
riship | ||||
black.bitch222 | ||||
awesomeanil | ||||
binusasi | ||||
hacker1187 | ||||
apocalypto!! | ||||
evergreen55555 |
Mixed Mode
3 posters
Page 1 of 1
Mixed Mode
If both operands have the same type, then the resulting value has that type. If
operands have different types, then the weaker of two types is promoted to the
stronger type, where the weaker type is the one with less precision or fewer
storage units. The ranking is summarized in the following table:
operands have different types, then the weaker of two types is promoted to the
stronger type, where the weaker type is the one with less precision or fewer
storage units. The ranking is summarized in the following table:
nbbhusal- Achiever
- Posts : 474
Join date : 2012-06-07
Re: Mixed Mode
Note – REAL*4, INTEGER*8, and LOGICAL*8 are of the same rank, but they
can be the results of different pairs of operands. For example, INTEGER*8
results if you combine INTEGER*8 and any of the types between 1-5. Likewise,
REAL*4 results if one of the operands is REAL*4, and the other is any of the
types between 1-5. LOGICAL*8 dictates only the 8-byte size of the result.
can be the results of different pairs of operands. For example, INTEGER*8
results if you combine INTEGER*8 and any of the types between 1-5. Likewise,
REAL*4 results if one of the operands is REAL*4, and the other is any of the
types between 1-5. LOGICAL*8 dictates only the 8-byte size of the result.
nbbhusal- Achiever
- Posts : 474
Join date : 2012-06-07
Re: Mixed Mode
Rules
Note these rules for the data type of an expression:
• If there is more than one operator in an expression, then the type of the last
operation performed becomes the type of the final value of the expression.
• Integer operators apply to only integer operands.
Example: An expression that evaluates to zero:
• When an INTEGER*8 operand is mixed with REAL*4 operands, the result is
REAL*8.
There is one extension to this: a logical or byte operand in an arithmetic
context is used as an integer.
Note these rules for the data type of an expression:
• If there is more than one operator in an expression, then the type of the last
operation performed becomes the type of the final value of the expression.
• Integer operators apply to only integer operands.
Example: An expression that evaluates to zero:
• When an INTEGER*8 operand is mixed with REAL*4 operands, the result is
REAL*8.
There is one extension to this: a logical or byte operand in an arithmetic
context is used as an integer.
nbbhusal- Achiever
- Posts : 474
Join date : 2012-06-07
Re: Mixed Mode
• Real operators apply to only real operands, or to combinations of byte,
logical, integer, and real operands. An integer operand mixed with a real
operand is promoted to real; the fractional part of the new real number is
zero. For example, if R is real, and I is integer, then R+I is real. However,
(2/3)*4.0 is 0.
• Double precision operators apply to only double precision operands, and
any operand of lower precision is promoted to double precision. The new
least significant bits of the new double precision number are set to zero.
Promoting a real operand does not increase the accuracy of the operand.
logical, integer, and real operands. An integer operand mixed with a real
operand is promoted to real; the fractional part of the new real number is
zero. For example, if R is real, and I is integer, then R+I is real. However,
(2/3)*4.0 is 0.
• Double precision operators apply to only double precision operands, and
any operand of lower precision is promoted to double precision. The new
least significant bits of the new double precision number are set to zero.
Promoting a real operand does not increase the accuracy of the operand.
nbbhusal- Achiever
- Posts : 474
Join date : 2012-06-07
Re: Mixed Mode
Numeric operations are allowed on logical variables. © You can use a logical
value any place where the FORTRAN 77 Standard requires a numeric value.
The numeric can be integer, real, complex, double precision,
double complex, or real*16 (SPARC only). The compiler implicitly
converts the logical to the appropriate numeric. Logical operations are
allowed on integers, bytes, and characters. If you use these features, your
program may not be portable.
value any place where the FORTRAN 77 Standard requires a numeric value.
The numeric can be integer, real, complex, double precision,
double complex, or real*16 (SPARC only). The compiler implicitly
converts the logical to the appropriate numeric. Logical operations are
allowed on integers, bytes, and characters. If you use these features, your
program may not be portable.
nbbhusal- Achiever
- Posts : 474
Join date : 2012-06-07
Re: Mixed Mode
Resultant Type
For integer operands with a logical operator, the operation is done bit by bit.
The result is an integer.
If the operands are mixed integer and logical, then the logicals are converted to
integers, and the result is an integer.
For integer operands with a logical operator, the operation is done bit by bit.
The result is an integer.
If the operands are mixed integer and logical, then the logicals are converted to
integers, and the result is an integer.
nbbhusal- Achiever
- Posts : 474
Join date : 2012-06-07
Re: Mixed Mode
Arithmetic Assignment
The arithmetic assignment statement assigns a value to a variable, array
element, or record field. The syntax is:
Assigning logicals to numerics is allowed, but nonstandard, and may not be
portable. The resultant data type is, of course, the data type of v. ©
COMPLEX C1 / ( 1.0, 2.0 ) /
INTEGER*2 I1, I2, I3
LOGICAL L1, L2, L3, L4, L5
REAL R1 / 1.0 /
DATA I1 / 8 /, I2 / 'W' /, I3 / 0 /
DATA L1/.TRUE./, L2/.TRUE./, L3/.TRUE./, L4/.TRUE./,
& L5/.TRUE./
L1 = L1 + 1
I2 = .NOT. I2
L2 = I1 .AND. I3
L3 = I1 .OR. I2
L4 = L4 + C1
L5 = L5 + R1
v = e
e Arithmetic expression, a character constant, or a logical expression
v Numeric variable, array element, or record field
The arithmetic assignment statement assigns a value to a variable, array
element, or record field. The syntax is:
Assigning logicals to numerics is allowed, but nonstandard, and may not be
portable. The resultant data type is, of course, the data type of v. ©
COMPLEX C1 / ( 1.0, 2.0 ) /
INTEGER*2 I1, I2, I3
LOGICAL L1, L2, L3, L4, L5
REAL R1 / 1.0 /
DATA I1 / 8 /, I2 / 'W' /, I3 / 0 /
DATA L1/.TRUE./, L2/.TRUE./, L3/.TRUE./, L4/.TRUE./,
& L5/.TRUE./
L1 = L1 + 1
I2 = .NOT. I2
L2 = I1 .AND. I3
L3 = I1 .OR. I2
L4 = L4 + C1
L5 = L5 + R1
v = e
e Arithmetic expression, a character constant, or a logical expression
v Numeric variable, array element, or record field
nbbhusal- Achiever
- Posts : 474
Join date : 2012-06-07
Re: Mixed Mode
thank you so much for sharing the new message among us.i hope you will keep on posting like this kind of threads.and i also hope that you and all the ved members will have a good earning from ved international .thank you.
dipeshgainju- LEADER Of ALL
- Posts : 2587
Join date : 2012-06-05
Location : dattatraya
Re: Mixed Mode
Oh this is really a new information to me.. I didn't know about that..Well thank you so much for sharing that thread with us in this forum.
sujin007- Eligible
- Posts : 11545
Join date : 2012-07-06
Age : 30
Location : Putalisadak, Kahmandu
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|