View by Category

Loading...

PPT – Five Fundamental Math Operations PowerPoint presentation | free to view

The Adobe Flash plugin is needed to view this content

About This Presentation

Write a Comment

User Comments (0)

Transcript and Presenter's Notes

Topics

- Five Fundamental Math Operations
- Precedence of Math Operations
- Using Parentheses to override precedence
- Writing and Interpreting VB Calculation

Statements - Mathematical Functions

A computer lets you make more mistakes faster

than any invention in human historywith the

possible exceptions of handguns and

tequila Mitch Ratcliffe

Numeric Operations in Computer Code

- Computers were invented to process large

quantities of numeric data - Computers perform arithmetic operations on

numeric values incredibly rapidly - All computer operations can be performed using

the basic operations of addition, subtraction,

multiplication, and division. - Most computer languages also provide for

exponentiation - Most also provide built in functions for more

complex operations

Objectives

- Understand the five fundamental arithmetic

operations in VB - Understand how to write and interpret

mathematical calculations in VB - Understand the precedence of mathematical

operations in computers and how parenthetical

grouping affects calculation order - Understand the use of predefined mathematical

functions available in VB

Five Fundamental Arithmetic Operations

- VB supports five built-in arithmetic operations
- Operation Conventional Notation Computer

Symbol - Addition 3 4 3 4
- Subtraction 3 - 4 3 - 4
- Multiplication 3 x 4 3 4
- Division 3 ??? 3 / 4
- Exponentiation 34 3 4

The Assignment Operation

- Many times the results of a calculation or other

operation are assigned to a variable, property,

or other value holder - iSum iFirstValue iSecondValue
- iSum Val(txtFirst.Text) Val(txtSecond.Text)
- MainMenu.Top (Screen.Height - MainMenu.Height)

/ 3 - The calculation on the right of the equal sign is

performed first and assigned to the location on

the left - The Equal Sign is an assignment operator

Using Numeric Calculations

- Legal statements
- x 4
- y 2
- z x 5
- t x 2
- txtPrice.Text x y
- Const Pi 3.14
- dblDiameter Pi sglRadius
- dSqrt x .5

- Illegal statements
- 4
- x y
- z x txtInput.Text
- sglPrice 1,456.98

Precedence of Numeric Calculations

- Q What is the result of 3 5 2?A
- Numeric operations have a defined hierarchy or

precedence of calculation - 1. Exponentiation
- 2. Multiplication and division
- 3. Addition and subtraction
- 4. Left to right within categories
- Because multiplication precedes addition 5 is

multiplied by two giving 10 first after which the

three is added to give 13

Precedence Exercises

What are the results of the following

calculations if x 12 and y 4?

- x y / 2
- y 3 / 4
- x 2 y - 2 x
- 8 x y / 3
- -8 y -2
- 16 (1 / 4)

Using Parentheses to Group Calculations

- Operations grouped in parentheses are performed

first, regardless of the natural order of

calculation3 5 2 13(3 5) 2 16 - Parentheses may be nested((3 5) 8) / (2 4)

? - Parentheses may be used to visually format

mathematical expressions even if no change to the

calculation order is needed

Inner parentheses are evaluated first

More Precedence Exercises

Write computer expressions for each mathematical

expression

Numeric Functions

- VB (and most other programming languages) provide

predefined numeric calculations in the form of

functions - Functions often operate on a value and return

some transformation of the value - E.g. in x 25 y Sqr(x)Sqr( ) is a

predefined function which returns the square root

of its argument (x in this case)

Functions and Expressions as Arguments

- Functions may be nested
- E.g., in Math.Sqr(Math.Abs(x))
- the absolute value of x is determined first and

then becomes the argument of the square root

function - A calculation may be performed inside the

argument of a function - E.g., in Math.Sqr(x 2)
- the value of x is first squared and then the

square root of the result is taken - Functions are always calculated from the inside

out

Empty Variables in Mathematical Operations

- Variables which have never been assigned a value

are said to be empty - If a mathematical operation is performed on an

empty variable the variable behaves as if its

value is zero - Be very careful as division by zero results in a

runtime error which will crash the program. - NB Variables loaded from databases may sometimes

contain a null value which is different from

empty.

Converting Data Types

Introduces inefficiency

- VB will automatically convert many numeric data

types before performing calculations - Single precision values can be multiplied by

integers, assigned to currency variables etc. - Some conversions cannot take place
- String values cannot be assigned to explicitly

declared numeric variables (non variants) - Commonly arises when using text boxes, list

boxes, grid controls, etc.

The Val( ) Function

- Val( ) returns the numeric value of its argument
- Argument is typically a string but may be a

number - Val converts strings to numbers
- A common use of Val is to convert values which

must be treated as text into numbersintQty

Val(txtQty.Text)intCourse Val(cboCourseNumber.T

ext)sglPrice Val(InputForm.Tag) - Or use the Convert method

Some properties always contain characters

The Val ( ) Function Examples

- Val (123.54) 123.54
- Val () 0
- Val(123A45) 123
- Val(A123) 0
- Val( 123 456) 123456

Methods of the Math Class

(No Transcript)

About PowerShow.com

PowerShow.com is a leading presentation/slideshow sharing website. Whether your application is business, how-to, education, medicine, school, church, sales, marketing, online training or just for fun, PowerShow.com is a great resource. And, best of all, most of its cool features are free and easy to use.

You can use PowerShow.com to find and download example online PowerPoint ppt presentations on just about any topic you can imagine so you can learn how to improve your own slides and presentations for free. Or use it to find and download high-quality how-to PowerPoint ppt presentations with illustrated or animated slides that will teach you how to do something new, also for free. Or use it to upload your own PowerPoint slides so you can share them with your teachers, class, students, bosses, employees, customers, potential investors or the world. Or use it to create really cool photo slideshows - with 2D and 3D transitions, animation, and your choice of music - that you can share with your Facebook friends or Google+ circles. That's all free as well!

For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!

You can use PowerShow.com to find and download example online PowerPoint ppt presentations on just about any topic you can imagine so you can learn how to improve your own slides and presentations for free. Or use it to find and download high-quality how-to PowerPoint ppt presentations with illustrated or animated slides that will teach you how to do something new, also for free. Or use it to upload your own PowerPoint slides so you can share them with your teachers, class, students, bosses, employees, customers, potential investors or the world. Or use it to create really cool photo slideshows - with 2D and 3D transitions, animation, and your choice of music - that you can share with your Facebook friends or Google+ circles. That's all free as well!

For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!

presentations for free. Or use it to find and download high-quality how-to PowerPoint ppt presentations with illustrated or animated slides that will teach you how to do something new, also for free. Or use it to upload your own PowerPoint slides so you can share them with your teachers, class, students, bosses, employees, customers, potential investors or the world. Or use it to create really cool photo slideshows - with 2D and 3D transitions, animation, and your choice of music - that you can share with your Facebook friends or Google+ circles. That's all free as well!

For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!

For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!

Recommended

«

/ »

Page of

«

/ »

Promoted Presentations

Related Presentations

Page of

Page of

CrystalGraphics Sales Tel: (800) 394-0700 x 1 or Send an email

Home About Us Terms and Conditions Privacy Policy Contact Us Send Us Feedback

Copyright 2015 CrystalGraphics, Inc. — All rights Reserved. PowerShow.com is a trademark of CrystalGraphics, Inc.

Copyright 2015 CrystalGraphics, Inc. — All rights Reserved. PowerShow.com is a trademark of CrystalGraphics, Inc.

The PowerPoint PPT presentation: "Five Fundamental Math Operations" is the property of its rightful owner.

Do you have PowerPoint slides to share? If so, share your PPT presentation slides online with PowerShow.com. It's FREE!

Committed to assisting Ucf University and other schools with their online training by sharing educational presentations for free