Hazırlayan:Emin BORANDAĞ 2/17/20161. Numerik Değerler Kullanımı Integers are considered accurate up to 15 digits. Try it function myFunction() { var x.

Slides:



Advertisements
Similar presentations
Return values.
Advertisements

Arithmetic in Pascal (2) Arithmetic Functions Perform arithmetic calculations Gives an argument to the function and it returns the result.
Maths & Trig, Statistical functions. ABS Returns the absolute value of a number The absolute value of a number is the number without its sign Syntax ◦
Numbers. Number data types store numeric values They are immutable data types, which means that changing the value of a number data type results in a.
Copyright 2011 by Pearson Education Building Java Programs Chapter 3 Lecture 3-2: Return values, Math, and double reading: 3.2,
Lecture 6 MATLAB functions Basics of Built-in Functions, Help Feature, Elementary Functions (e.g., Polynomials, Trigonometric Functions), Data Analysis,
Copyright 2006 by Pearson Education 1 Building Java Programs Chapter 3: Parameters, Return, and Interactive Programs with Scanner.
Numerical Data Recitation – 01/30/2009
Copyright 2008 by Pearson Education Building Java Programs Chapter 3 Lecture 3-2: Return; double ; System.out.printf reading: 3.2, 3.5, 4.4 videos: Ch.
Copyright 2008 by Pearson Education Building Java Programs Chapter 3 Lecture 3-2: Return; double ; System.out.printf reading: 3.2, 3.5, 4.4 videos: Ch.
Microsoft® Small Basic The Math Object Estimated time to complete this lesson: 1 hour.
1 CS101 Introduction to Computing Lecture 38 String Manipulations (Web Development Lecture 13)
1 CS101 Introduction to Computing Lecture 35 Mathematical Methods (Web Development Lecture 12)
Working with Numbers parseInt() and parseFloat() Math.round() Other Math object functions isNaN() toFixed()
Using Object-Oriented JavaScript CST 200- JavaScript 4 –
EG280 - CS for Engineers Chapter 2, Introduction to C Part I Topics: Program structure Constants and variables Assignment Statements Standard input and.
JavaScript Part 2 – Page 1 of 35CSCI 2910 – Client/Server-Side Programming CSCI 2910 Client/Server-Side Programming Topic: JavaScript Part 2.
CP476 Internet Computing JavaScript Client-Side Programming 1 1. What is JavaScript –Another script language for both client-side and sever-side programming.
Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved. 1 Chapter 4 Mathematical Functions, Characters,
Chapter 3: Data Types and Operators JavaScript - Introductory.
IMS 3253: Math 1 Dr. Lawrence West, MIS Dept., University of Central Florida Topics Five Fundamental Math Operations Precedence of Math.
Copyright ©2005  Department of Computer & Information Science Using Number & Math Objects.
CSC1015F – Chapter 3, Computing with Numbers Michelle Kuttel
Javascript. Javascript Tools Javascript Console Javascript Console Debugger Debugger DOM Inspector DOM Inspector.
JavaScript For...In Statement The for...in statement loops through the elements of an array or through the properties of an object. Syntax for (variable.
JavaScript Functions & Objects. JavaScript Functions FunctionDescription decodeURI()Decodes an encoded URI decodeURIComponent()Decodes an encoded URI.
CHAPTER 4 Java Script อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
More on Objects. Goals By the end of this unit you should … … be able to identify selected String properties … be able to identify and use selected String.
Copyright 2011 by Pearson Education Building Java Programs Chapter 3 Lecture 7: Return values, Math, and double reading: 3.2,
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
CSC Programming for Science Lecture 7: Math Functions.
Keeping it Neat: Functions and JavaScript Source Files Chapter 7.
Math With Java The Math Class. First, A Quick Review of Math Operators in Java Primitive Data type in Java that represent numbers: Primitive Data type.
Numbers © Copyright 2014, Fred McClurg All Rights Reserved.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Chapter 6 Mathematical Operations. 6.1 Mathematical Expressions In mathematics this expression is valid 0 = -4y + 5 It is invalid in programming Left.
Significant Figure Rules RulesExamples The following are always significant Non zero digits Zeros between non zero digits Zero to the right of a non zero.
JS1-1 Introduction to JavaScript (JavaScript 1) Xingquan (Hill) Zhu
CSC 330 E-Commerce Teacher Ahmed Mumtaz Mustehsan Ahmed Mumtaz Mustehsan GM-IT CIIT Islamabad GM-IT CIIT Islamabad CIIT Virtual Campus, CIIT COMSATS Institute.
CSCE 102 – Chapter 11 (Performing Calculations) CSCE General Applications Programming Benito Mendoza Benito Mendoza 1 By Benito Mendoza.
The Math Class Methods Utilizing the Important Math Operations of Java!
1 Java Library Lecture 9 by Dr. Norazah Yusof. 2 Java Library Java has pre-defined classes that consist of the basic language classes in Java (organized.
XP Tutorial 2 New Perspectives on JavaScript, Comprehensive1 Working with Operators and Expressions Creating a New Year’s Day Countdown Clock.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
Java Script Dvijesh Bhatt. Web Page HTML defines Web sites content through semantic tags (headings, paragraphs, lists, …). CSS defines 'rules' or 'styles'
29 January 2016Birkbeck College, U. London1 Introduction to Programming Lecturer: Steve Maybank Department of Computer Science and Information Systems.
ICS 3U Math Class. ActionScript 3 – Math Class Rounding ceil – closest integer >= number (rounds up) floor – closest integer
JavaScript and Ajax (JavaScript Functions) Week 5 Web site:
Chapter 4 Numbers CSC1310 Fall Python Program Structure import math r=int(raw_input()) print 4.0/3*math.pi*r**3 volume.py: Program Program Module.
Useful Python CMSC 120: Visualizing Information. Scope def area(diameter): radius = diameter / 2.0 A = PI * radius ** 2 return A def circumference(diameter):
Modern JavaScript Develop And Design Instructor’s Notes Chapter 4 – Simple Variable Types Modern JavaScript Design And Develop Copyright © 2012 by Larry.
Copyright 2011 by Pearson Education Building Java Programs Chapter 3 Lecture 3-2: Return values, Math, and double reading: 3.2,
JavaScript Tutorial. What is JavaScript JavaScript is the programming language of HTML and the Web Programming makes computers do what you want them to.
Chapter 4 Mathematical Functions, Characters, and Strings 1.
Simple C Programs.
JavaScript Basics Stephen Delaney
Chapter 4 Mathematical Functions, Characters, and Strings
Math class Random() method Floor method Top-level parseInt function
Math Class Your favorite class!.
BIL 104E Introduction to Scientific and Engineering Computing
Chapter 4 Mathematical Functions, Characters, and Strings
Java Script.
Chapter 3 Methods.
Chapter 4: Mathematical Functions, Characters, and Strings
JavaScript Basics Stephen Delaney
Tutorial 4 JavaScript as OOP Li Xu
Using Built In Objects Kevin Harville.
Php – Math functions.
Working with Numbers parseInt() and parseFloat() Math.round()
Ch 5 : Mathematical Functions, Characters, and Strings
Presentation transcript:

Hazırlayan:Emin BORANDAĞ 2/17/20161

Numerik Değerler Kullanımı Integers are considered accurate up to 15 digits. Try it function myFunction() { var x = ; var y = ; document.getElementById("demo").innerHTML = x + " " + y; } 2/17/20162

Numerik Değerler Kullanımı Küçük Hatalar Floating point arithmetic is not always 100% accurate. Try it function myFunction() { var x = ; document.getElementById("demo").innerHTML = " = " + x; } 2/17/20163

Numerik Değerler Kullanımı Floating point arithmetic is not always 100% accurate. But it helps to multiply and divide. Try it function myFunction() { var x = (0.2* *10) / 10; document.getElementById("demo").innerHTML = " = " + x; } 2/17/20164

Numerik Değerler Kullanımı Hex Sayılar Numeric constants, preceded by 0x, are interpreted as hexadecimal. Try it function myFunction() { document.getElementById("demo").innerHTML = "0xFF = " + 0xFF; } 2/17/20165

Numerik Değerler Kullanımı Numeric constants, preceded by 0x, are interpreted as hexadecimal. Try it function myFunction() { document.getElementById("demo").innerHTML = "0xFF = " + 0xFF; } 2/17/20166

Numerik Değerler Kullanımı-Sınırları Zorlama Infinity is returned if you calculate a number outside the largest possible number. Try it function myFunction() { var myNumber = 2; var txt = ""; while (myNumber != Infinity) { myNumber = myNumber * myNumber; txt = txt + myNumber + " "; } document.getElementById("demo").innerHTML = txt; } 2/17/20167

Sonsuzluk Division by zero also generates Infinity. Try it function myFunction() { var x = 2/0; var y = -2/0; document.getElementById("demo").innerHTML = x + " " + y; } 2/17/20168

Tip Dönüşümü Infinity is a Number. Try it function myFunction() { document.getElementById("demo").innerHTML = typeof Infinity; } 2/17/20169

Veri Bozulması A number divided by a non-numeric string becomes NaN (Not a Number): document.getElementById("demo").innerHTML = 100 / "Apple"; 2/17/201610

Numerik Kullanım A number divided by a numeric string becomes a number: document.getElementById("demo").innerHTML = 100 / "10"; 2/17/201611

Numerik Değerler var x = 100 / "Apple"; document.getElementById("demo").innerHTML = isNaN(x); 2/17/201612

Numerik Değerler If you use NaN in a mathematical operation, the result will also be NaN: var x = NaN; var y = 5; document.getElementById("demo").innerHTML = x + y; 2/17/201613

Veri Dönüşümü The typeof NaN is: document.getElementById("demo").innerHTML = typeof NaN; 2/17/201614

Numerik Değerler ve Obje var x = 123; var y = new Number(123); document.getElementById("demo").innerHTML = typeof x + " " + typeof y; 2/17/201615

Doğru Değer Karşılaştırma Never create numbers as objects. Numbers and objects cannot be safely compared. var x = 500; // x is a number var y = new Number(500); // y is an object document.getElementById("demo").innerHTML = (x==y); 2/17/201616

Obje ve Numerik Değer Karşılaştırma Never create numbers as objects. JavaScript objects cannot be compared. var x = new Number(500); // x is an object var y = new Number(500); // y is an object document.getElementById("demo").innerHTML = (x==y); 2/17/201617

Hazır Değerler 2/17/ PropertyDescription MAX_VALUE Returns the largest number possible in JavaScript MIN_VALUE Returns the smallest number possible in JavaScript NEGATIVE_INFINITY Represents negative infinity (returned on overflow) NaNRepresents a "Not-a-Number" value POSITIVE_INFINITY Represents infinity (returned on overflow)

Max Value document.getElementById("demo").innerHTML = Number.MAX_VALUE; 2/17/201619

Java Script’te En Çok Kullanılan Global Methodlar 2/17/ MethodDescription Number() Returns a number, converted from its argument. parseFloat() Parses its argument and returns a floating point number parseInt() Parses its argument and returns an integer

Java Script’te Kullanılan Nümerik Methodlar 2/17/ MethodDescription toString()Returns a number as a string toExponential() Returns a string, with a number rounded and written using exponential notation. toFixed() Returns a string, with a number rounded and written with a specified number of decimals. toPrecision() Returns a string, with a number written with a specified length valueOf()Returns a number as a number

Js ToString The toString() method converts a number to a string. var x = 123; document.getElementById("demo").innerHTML = x.toString() + " " + (123).toString() + " " + ( ).toString(); 2/17/201622

Js to Exponential The toExponential() method returns a string, with the number rounded and written using exponential notation. An optional parameter defines the number of digits behind the decimal point. var x = 9.656; document.getElementById("demo").innerHTML = x.toExponential() + " " + x.toExponential(2) + " " + x.toExponential(4) + " " + x.toExponential(6); 2/17/201623

Js ToFixed The toFixed() method rounds a number to a given number of digits. For working with money, toFixed(2) is perfect. var x = 9.656; document.getElementById("demo").innerHTML = x.toFixed(0) + " " + x.toFixed(2) + " " + x.toFixed(4) + " " + x.toFixed(6); 2/17/201624

Js Precision The toPrecision() method returns a string, with a number written with a specified length: var x = 9.656; document.getElementById("demo").innerHTML = x.toPrecision() + " " + x.toPrecision(2) + " " + x.toPrecision(4) + " " + x.toPrecision(6); 2/17/201625

Js Number The global JavaScript function Number() converts variables to numbers: document.getElementById("demo").innerHTML = Number(true) + " " + Number(false) + " " + Number(" 10") + " " + Number("10 6"); 2/17/201626

Js ParseInt The global JavaScript function parseInt() converts strings to numbers: document.getElementById("demo").innerHTML = parseInt("10") + " " + parseInt("10.33") + " " + parseInt("10 6") + " " + parseInt("10 years") + " " + parseInt("years 10"); 2/17/201627

Js ParseFloat The global JavaScript function parseFloat() converts strings to numbers: document.getElementById("demo").innerHTML = parseFloat("10") + " " + parseFloat("10.33") + " " + parseFloat("10 6") + " " + parseFloat("10 years") + " " + parseFloat("years 10"); 2/17/201628

Js ValueOf var x = 123; document.getElementById("demo").innerHTML = x.valueOf() + " " + (123).valueOf() + " " + ( ).valueOf(); 2/17/201629

Js Math Kütüphanesi Random Math.random() returns a random number betwween 0 and 1. Try it function myFunction() { document.getElementById("demo").innerHTML = Math.random(); } 2/17/201630

Js Min / Max Kullanımı Math.min() returns the lowest value. Try it function myFunction() { document.getElementById("demo").innerHTML = Math.min(0, 150, 30, 20, -8); } 2/17/201631

Js Random Fonksiyon ile Kullanımı In HTML, all global variables will become a window variables. myFunction(); document.getElementById("demo").innerHTML = "I can display " + window.carName; function myFunction() { carName = "Volvo"; } 2/17/201632

Js Round Math.round() rounds a number to its nearest integer. Try it function myFunction() { document.getElementById("demo").innerHTML = Math.round(5.7); } 2/17/201633

Js Ceil Math.ceil() rounds a number up to its nearest integer. Try it function myFunction() { document.getElementById("demo").innerHTML = Math.ceil(4.4); } 2/17/201634

Js Floor Math.floor() rounds a number down to its nearest integer. Try it function myFunction() { document.getElementById("demo").innerHTML = Math.floor(4.7); } 2/17/201635

Js Random & Ceil Birlikte Kullanım 2/17/ Math.floor() combined with Math.random() can return random integers. Try it function myFunction() { document.getElementById("demo").innerHTML = Math.floor(Math.random() * 11); }

Js ve Hazır Math Math constants are E, PI, SQR2, SQR1_2, LN2, LN10, LOG2E, LOG10E Try it function myFunction() { document.getElementById("demo").innerHTML = Math.E + " " + Math.PI + " " + Math.SQRT2 + " " + Math.SQRT1_2 + " " + Math.LN2 + " " + Math.LN10 + " " + Math.LOG2E + " " + Math.LOG10E + " "; } 2/17/201637

Js Hazır Methodlar 2/17/ MethodDescription abs(x)Returns the absolute value of x acos(x)Returns the arccosine of x, in radians asin(x)Returns the arcsine of x, in radians atan(x)Returns the arctangent of x as a numeric value between -PI/2 and PI/2 radians atan2(y,x)Returns the arctangent of the quotient of its arguments ceil(x)Returns x, rounded upwards to the nearest integer cos(x)Returns the cosine of x (x is in radians) exp(x)Returns the value of E x floor(x)Returns x, rounded downwards to the nearest integer log(x)Returns the natural logarithm (base E) of x max(x,y,z,...,n)Returns the number with the highest value min(x,y,z,...,n)Returns the number with the lowest value pow(x,y)Returns the value of x to the power of y random()Returns a random number between 0 and 1 round(x)Rounds x to the nearest integer sin(x)Returns the sine of x (x is in radians) sqrt(x)Returns the square root of x tan(x)Returns the tangent of an angle

İleriwep Programlama Dersinde İşlenecek Js ile İlgili Kalan Konular JS Forms (API), JS HTML DOM JS Browser BOM, JS Libraries, Js JQuery JS Hoisting / JS Strict Mode/JS Style Guide/ JS Best Practices/ JS Mistakes/ JS Performance JS Reserved Words / JS JSON 2/17/201639