SlideShare a Scribd company logo
1 of 13
Basic Scientific Programming
Computer Arithmetic

Eyad Taqieddin

1
Arithmetic Operations and Functions
Operator

Operation

Fortran Notation

+

Addition,Unary Plus

a+b , +b

-

Subtraction,Unary
Minus

a-b , -b

*

Multiplication

a*b

/

Division

a/b

Exponentiation

a**b

**

Eyad Taqieddin

2
Integer Arithmetic





Int
Int
Int
Int

+ Int = Int
- Int = Int
* Int = Int
/ Int = Int

5+2=7
5 -2=3
5 * 2 = 10
5 / 2 = 2 why?

Division is a special case, because the result
must be an integer. So, the fraction part is
truncated, and only the integer is stored.
Eyad Taqieddin

3
Example
what is the result of the following?
1) program example
Implicit none
Real :: x= 2.0 , y
Integer :: n = 2, j
y= 1/x
j= 1/n
print *, ‘y=‘ , y
print *, ‘j=‘, j
end program example
Eyad Taqieddin

4
Priority Rules
1) Parenthesis
2) All exponentiations are performed first, consecutive
exponentiations are performed from right to left.
3) All Multiplications and divisions are performed next,
in the order in which they appear from left to right.
4) The additions and subtractions are performed last,
in the order in which they appear from left to right.

Eyad Taqieddin

5
Example


2**3**2 = 2**9 = 512



10-8-2 = 2 – 2 = 0



2+4/2 +5**3 = 2+ 4/2+125=2+2+125
= 129

Eyad Taqieddin

6
Example



((-b) + sqrt( B**2 – 4*a*c))/(2*a)
((-b) + sqrt( B**2 – 4*a*c))/2*a
do u think these expressions are equal??

Eyad Taqieddin

7
Mixed Mode Expressions
Expressions that involve different types of
numeric operands
Int + Real = Real
Int - Real = Real
Int * Real = Real
Int / Real = Real
The integer value is converted to its real
equivalent.
Eyad Taqieddin

8
Example




2.0/5  2.0/5.0  0.4
3.0 + 6/4  3.0 + 1  3.0 +1.0  4.0
3.0 + 6.0/4 3.0+ 6.0/4.0  3.0 +1.5
 4.5
from the second and third expressions we see
why it is not a good programming practice to
use mixed mode operations.
Eyad Taqieddin

9
Functions
Fortran provides library functions for many
mathematical operations and functions.
Ex:

ABS(X) returns the absolute value of X
Sqrt(X) returns the square root of X
Sin(X) returns the sine of X radians

Eyad Taqieddin

10
The Assignment Statement
Form
Variable = Expression



Variable is a valid Fortran identifier.
Expression may be a constant, another
varialble to which a value has previously been
assigned or a formula to be evaluated.

Eyad Taqieddin

11
Example






Length = 6
assigns the value 6 to the memory location length.
C= x**2 + 5*x + 7
calculates the expressions (x**2 + 5*x + 7) and
assigns the result to the memory location C.
Salary = Salary + 1000
adds the value 1000 to the value stored in the
memory location salary and then stores the result in
the same memory location.
The previous value of salary is lost.
Eyad Taqieddin

12
Integer Vs. Real




If an integer-valued expression is assigned to a real
variable, the integer value is converted to a real
constant and then assigned to the variable.
temp = (6+2)/4 “assuming temp is real”
temp will be assigned the value 2.0 not 2
If a real-valued expression is assigned to an integer
variable, the fractional part is truncated and the
integer part is assigned to the variable.
temp = 2.36 / 2 “assuming temp is integer”
temp will be assigned the value 1 not 1.18
Eyad Taqieddin

13

More Related Content

What's hot

Gsp 215 Enhance teaching-snaptutorial.com
Gsp 215 Enhance teaching-snaptutorial.comGsp 215 Enhance teaching-snaptutorial.com
Gsp 215 Enhance teaching-snaptutorial.comrobertleew18
 
Operators and expressions
Operators and expressionsOperators and expressions
Operators and expressionsvishaljot_kaur
 
Three Address code
Three Address code Three Address code
Three Address code Pooja Dixit
 
Consider the following C program: int fun(int *i) { *i += 5; return 4; } void...
Consider the following C program: int fun(int *i) { *i += 5; return 4; } void...Consider the following C program: int fun(int *i) { *i += 5; return 4; } void...
Consider the following C program: int fun(int *i) { *i += 5; return 4; } void...hwbloom119
 
Presentation(intermediate code generation)
Presentation(intermediate code generation)Presentation(intermediate code generation)
Presentation(intermediate code generation)Sourov Kumar Ron
 
Introduction To Algorithm [2]
Introduction To Algorithm [2]Introduction To Algorithm [2]
Introduction To Algorithm [2]ecko_disasterz
 
C Prog. - Operators and Expressions
C Prog. - Operators and ExpressionsC Prog. - Operators and Expressions
C Prog. - Operators and Expressionsvinay arora
 
Redo midterm
Redo midtermRedo midterm
Redo midtermIIUM
 
Three address code generation
Three address code generationThree address code generation
Three address code generationRabin BK
 
GSP 215 Education Organization - snaptutorial.com
GSP 215  Education Organization - snaptutorial.comGSP 215  Education Organization - snaptutorial.com
GSP 215 Education Organization - snaptutorial.comdonaldzs192
 
Gsp 215 Exceptional Education / snaptutorial.com
Gsp 215  Exceptional Education / snaptutorial.comGsp 215  Exceptional Education / snaptutorial.com
Gsp 215 Exceptional Education / snaptutorial.comBaileya55
 
Gsp 215 Enthusiastic Study / snaptutorial.com
Gsp 215 Enthusiastic Study / snaptutorial.comGsp 215 Enthusiastic Study / snaptutorial.com
Gsp 215 Enthusiastic Study / snaptutorial.comStephenson101
 

What's hot (19)

Assignment8
Assignment8Assignment8
Assignment8
 
Intermediate code
Intermediate codeIntermediate code
Intermediate code
 
Gsp 215 Enhance teaching-snaptutorial.com
Gsp 215 Enhance teaching-snaptutorial.comGsp 215 Enhance teaching-snaptutorial.com
Gsp 215 Enhance teaching-snaptutorial.com
 
Operators and expressions
Operators and expressionsOperators and expressions
Operators and expressions
 
Three Address code
Three Address code Three Address code
Three Address code
 
Consider the following C program: int fun(int *i) { *i += 5; return 4; } void...
Consider the following C program: int fun(int *i) { *i += 5; return 4; } void...Consider the following C program: int fun(int *i) { *i += 5; return 4; } void...
Consider the following C program: int fun(int *i) { *i += 5; return 4; } void...
 
Presentation(intermediate code generation)
Presentation(intermediate code generation)Presentation(intermediate code generation)
Presentation(intermediate code generation)
 
operators in c++
operators in c++operators in c++
operators in c++
 
Introduction To Algorithm [2]
Introduction To Algorithm [2]Introduction To Algorithm [2]
Introduction To Algorithm [2]
 
Programming with matlab session 4
Programming with matlab session 4Programming with matlab session 4
Programming with matlab session 4
 
C Prog. - Operators and Expressions
C Prog. - Operators and ExpressionsC Prog. - Operators and Expressions
C Prog. - Operators and Expressions
 
Programming with matlab session 3 notes
Programming with matlab session 3 notesProgramming with matlab session 3 notes
Programming with matlab session 3 notes
 
Computer
ComputerComputer
Computer
 
Assignment
AssignmentAssignment
Assignment
 
Redo midterm
Redo midtermRedo midterm
Redo midterm
 
Three address code generation
Three address code generationThree address code generation
Three address code generation
 
GSP 215 Education Organization - snaptutorial.com
GSP 215  Education Organization - snaptutorial.comGSP 215  Education Organization - snaptutorial.com
GSP 215 Education Organization - snaptutorial.com
 
Gsp 215 Exceptional Education / snaptutorial.com
Gsp 215  Exceptional Education / snaptutorial.comGsp 215  Exceptional Education / snaptutorial.com
Gsp 215 Exceptional Education / snaptutorial.com
 
Gsp 215 Enthusiastic Study / snaptutorial.com
Gsp 215 Enthusiastic Study / snaptutorial.comGsp 215 Enthusiastic Study / snaptutorial.com
Gsp 215 Enthusiastic Study / snaptutorial.com
 

Viewers also liked

Arithmetic Process in Computer Systems
Arithmetic Process in Computer SystemsArithmetic Process in Computer Systems
Arithmetic Process in Computer SystemsS N M P Simamora
 
Chapter 05 computer arithmetic
Chapter 05 computer arithmeticChapter 05 computer arithmetic
Chapter 05 computer arithmeticIIUI
 
Chapter 03 arithmetic for computers
Chapter 03   arithmetic for computersChapter 03   arithmetic for computers
Chapter 03 arithmetic for computersBảo Hoang
 
Csc1401 lecture03 - computer arithmetic - arithmetic and logic unit (alu)
Csc1401   lecture03 - computer arithmetic - arithmetic and logic unit (alu)Csc1401   lecture03 - computer arithmetic - arithmetic and logic unit (alu)
Csc1401 lecture03 - computer arithmetic - arithmetic and logic unit (alu)IIUM
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmeticgavhays
 
Computer architecture
Computer architectureComputer architecture
Computer architectureSanjeev Patel
 
Computer organiztion5
Computer organiztion5Computer organiztion5
Computer organiztion5Umang Gupta
 

Viewers also liked (9)

Arithmetic Process in Computer Systems
Arithmetic Process in Computer SystemsArithmetic Process in Computer Systems
Arithmetic Process in Computer Systems
 
09 arithmetic
09 arithmetic09 arithmetic
09 arithmetic
 
Chapter 05 computer arithmetic
Chapter 05 computer arithmeticChapter 05 computer arithmetic
Chapter 05 computer arithmetic
 
Chapter 03 arithmetic for computers
Chapter 03   arithmetic for computersChapter 03   arithmetic for computers
Chapter 03 arithmetic for computers
 
Computer arithmetic
Computer arithmeticComputer arithmetic
Computer arithmetic
 
Csc1401 lecture03 - computer arithmetic - arithmetic and logic unit (alu)
Csc1401   lecture03 - computer arithmetic - arithmetic and logic unit (alu)Csc1401   lecture03 - computer arithmetic - arithmetic and logic unit (alu)
Csc1401 lecture03 - computer arithmetic - arithmetic and logic unit (alu)
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmetic
 
Computer architecture
Computer architectureComputer architecture
Computer architecture
 
Computer organiztion5
Computer organiztion5Computer organiztion5
Computer organiztion5
 

Similar to 1 arithmetic

FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3rohassanie
 
Dti2143 chapter 3 arithmatic relation-logicalexpression
Dti2143 chapter 3 arithmatic relation-logicalexpressionDti2143 chapter 3 arithmatic relation-logicalexpression
Dti2143 chapter 3 arithmatic relation-logicalexpressionalish sha
 
C++ Course - Lesson 2
C++ Course - Lesson 2C++ Course - Lesson 2
C++ Course - Lesson 2Mohamed Ahmed
 
C interview question answer 2
C interview question answer 2C interview question answer 2
C interview question answer 2Amit Kapoor
 
The language is C. Thanks. Write a function that computes the intege.pdf
The language is C. Thanks. Write a function that computes the intege.pdfThe language is C. Thanks. Write a function that computes the intege.pdf
The language is C. Thanks. Write a function that computes the intege.pdfforwardcom41
 
C aptitude.2doc
C aptitude.2docC aptitude.2doc
C aptitude.2docSrikanth
 
C programming session 02
C programming session 02C programming session 02
C programming session 02Dushmanta Nath
 
Task4output.txt 2 5 9 13 15 10 1 0 3 7 11 14 1.docx
Task4output.txt 2  5  9 13 15 10  1  0  3  7 11 14 1.docxTask4output.txt 2  5  9 13 15 10  1  0  3  7 11 14 1.docx
Task4output.txt 2 5 9 13 15 10 1 0 3 7 11 14 1.docxjosies1
 
Class_IX_Operators.pptx
Class_IX_Operators.pptxClass_IX_Operators.pptx
Class_IX_Operators.pptxrinkugupta37
 
#OOP_D_ITS - 2nd - C++ Getting Started
#OOP_D_ITS - 2nd - C++ Getting Started#OOP_D_ITS - 2nd - C++ Getting Started
#OOP_D_ITS - 2nd - C++ Getting StartedHadziq Fabroyir
 
Operators inc c language
Operators inc c languageOperators inc c language
Operators inc c languageTanmay Modi
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c languagetanmaymodi4
 
Topic 2_revised.pptx
Topic 2_revised.pptxTopic 2_revised.pptx
Topic 2_revised.pptxJAYAPRIYAR7
 
Labsheet2 stud
Labsheet2 studLabsheet2 stud
Labsheet2 studrohassanie
 
Lecture 6 operators
Lecture 6   operatorsLecture 6   operators
Lecture 6 operatorseShikshak
 

Similar to 1 arithmetic (20)

FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3
 
Dti2143 chapter 3 arithmatic relation-logicalexpression
Dti2143 chapter 3 arithmatic relation-logicalexpressionDti2143 chapter 3 arithmatic relation-logicalexpression
Dti2143 chapter 3 arithmatic relation-logicalexpression
 
C++ Course - Lesson 2
C++ Course - Lesson 2C++ Course - Lesson 2
C++ Course - Lesson 2
 
C interview question answer 2
C interview question answer 2C interview question answer 2
C interview question answer 2
 
The language is C. Thanks. Write a function that computes the intege.pdf
The language is C. Thanks. Write a function that computes the intege.pdfThe language is C. Thanks. Write a function that computes the intege.pdf
The language is C. Thanks. Write a function that computes the intege.pdf
 
C aptitude.2doc
C aptitude.2docC aptitude.2doc
C aptitude.2doc
 
Captitude 2doc-100627004318-phpapp01
Captitude 2doc-100627004318-phpapp01Captitude 2doc-100627004318-phpapp01
Captitude 2doc-100627004318-phpapp01
 
C programming session 02
C programming session 02C programming session 02
C programming session 02
 
C Operators
C OperatorsC Operators
C Operators
 
Task4output.txt 2 5 9 13 15 10 1 0 3 7 11 14 1.docx
Task4output.txt 2  5  9 13 15 10  1  0  3  7 11 14 1.docxTask4output.txt 2  5  9 13 15 10  1  0  3  7 11 14 1.docx
Task4output.txt 2 5 9 13 15 10 1 0 3 7 11 14 1.docx
 
Class_IX_Operators.pptx
Class_IX_Operators.pptxClass_IX_Operators.pptx
Class_IX_Operators.pptx
 
#OOP_D_ITS - 2nd - C++ Getting Started
#OOP_D_ITS - 2nd - C++ Getting Started#OOP_D_ITS - 2nd - C++ Getting Started
#OOP_D_ITS - 2nd - C++ Getting Started
 
Operators inc c language
Operators inc c languageOperators inc c language
Operators inc c language
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c language
 
Topic 2_revised.pptx
Topic 2_revised.pptxTopic 2_revised.pptx
Topic 2_revised.pptx
 
1. Ch_1 SL_1_Intro to Matlab.pptx
1. Ch_1 SL_1_Intro to Matlab.pptx1. Ch_1 SL_1_Intro to Matlab.pptx
1. Ch_1 SL_1_Intro to Matlab.pptx
 
Labsheet2 stud
Labsheet2 studLabsheet2 stud
Labsheet2 stud
 
C language basics
C language basicsC language basics
C language basics
 
Aptitute question papers in c
Aptitute question papers in cAptitute question papers in c
Aptitute question papers in c
 
Lecture 6 operators
Lecture 6   operatorsLecture 6   operators
Lecture 6 operators
 

More from fyjordan9

More from fyjordan9 (17)

17recursion
17recursion17recursion
17recursion
 
16 subroutine
16 subroutine16 subroutine
16 subroutine
 
15 functions
15 functions15 functions
15 functions
 
14 arrays
14 arrays14 arrays
14 arrays
 
13 arrays
13 arrays13 arrays
13 arrays
 
12 doloops
12 doloops12 doloops
12 doloops
 
11 doloops
11 doloops11 doloops
11 doloops
 
10 examples for if statement
10 examples for if statement10 examples for if statement
10 examples for if statement
 
9 case
9 case9 case
9 case
 
8 if
8 if8 if
8 if
 
7 files
7 files7 files
7 files
 
6 read write
6 read write6 read write
6 read write
 
5 format
5 format5 format
5 format
 
4 design
4 design4 design
4 design
 
3 in out
3 in out3 in out
3 in out
 
2 int real
2 int real2 int real
2 int real
 
PHYS303
PHYS303PHYS303
PHYS303
 

Recently uploaded

Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 

Recently uploaded (20)

Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 

1 arithmetic

  • 1. Basic Scientific Programming Computer Arithmetic Eyad Taqieddin 1
  • 2. Arithmetic Operations and Functions Operator Operation Fortran Notation + Addition,Unary Plus a+b , +b - Subtraction,Unary Minus a-b , -b * Multiplication a*b / Division a/b Exponentiation a**b ** Eyad Taqieddin 2
  • 3. Integer Arithmetic     Int Int Int Int + Int = Int - Int = Int * Int = Int / Int = Int 5+2=7 5 -2=3 5 * 2 = 10 5 / 2 = 2 why? Division is a special case, because the result must be an integer. So, the fraction part is truncated, and only the integer is stored. Eyad Taqieddin 3
  • 4. Example what is the result of the following? 1) program example Implicit none Real :: x= 2.0 , y Integer :: n = 2, j y= 1/x j= 1/n print *, ‘y=‘ , y print *, ‘j=‘, j end program example Eyad Taqieddin 4
  • 5. Priority Rules 1) Parenthesis 2) All exponentiations are performed first, consecutive exponentiations are performed from right to left. 3) All Multiplications and divisions are performed next, in the order in which they appear from left to right. 4) The additions and subtractions are performed last, in the order in which they appear from left to right. Eyad Taqieddin 5
  • 6. Example  2**3**2 = 2**9 = 512  10-8-2 = 2 – 2 = 0  2+4/2 +5**3 = 2+ 4/2+125=2+2+125 = 129 Eyad Taqieddin 6
  • 7. Example   ((-b) + sqrt( B**2 – 4*a*c))/(2*a) ((-b) + sqrt( B**2 – 4*a*c))/2*a do u think these expressions are equal?? Eyad Taqieddin 7
  • 8. Mixed Mode Expressions Expressions that involve different types of numeric operands Int + Real = Real Int - Real = Real Int * Real = Real Int / Real = Real The integer value is converted to its real equivalent. Eyad Taqieddin 8
  • 9. Example    2.0/5  2.0/5.0  0.4 3.0 + 6/4  3.0 + 1  3.0 +1.0  4.0 3.0 + 6.0/4 3.0+ 6.0/4.0  3.0 +1.5  4.5 from the second and third expressions we see why it is not a good programming practice to use mixed mode operations. Eyad Taqieddin 9
  • 10. Functions Fortran provides library functions for many mathematical operations and functions. Ex: ABS(X) returns the absolute value of X Sqrt(X) returns the square root of X Sin(X) returns the sine of X radians Eyad Taqieddin 10
  • 11. The Assignment Statement Form Variable = Expression   Variable is a valid Fortran identifier. Expression may be a constant, another varialble to which a value has previously been assigned or a formula to be evaluated. Eyad Taqieddin 11
  • 12. Example    Length = 6 assigns the value 6 to the memory location length. C= x**2 + 5*x + 7 calculates the expressions (x**2 + 5*x + 7) and assigns the result to the memory location C. Salary = Salary + 1000 adds the value 1000 to the value stored in the memory location salary and then stores the result in the same memory location. The previous value of salary is lost. Eyad Taqieddin 12
  • 13. Integer Vs. Real   If an integer-valued expression is assigned to a real variable, the integer value is converted to a real constant and then assigned to the variable. temp = (6+2)/4 “assuming temp is real” temp will be assigned the value 2.0 not 2 If a real-valued expression is assigned to an integer variable, the fractional part is truncated and the integer part is assigned to the variable. temp = 2.36 / 2 “assuming temp is integer” temp will be assigned the value 1 not 1.18 Eyad Taqieddin 13