Print

Swift Tutorial: Introduction 06 - Variables: Floats and Doubles

Written by Paul Napier on . Posted in Swift Tutorials: Introduction

Hello everyone and welcome to the sixth lesson in swift programming brought to you by MadApper. my name is Paul Napier and in this lesson we will cover another two of the basic types: floats and doubles.

In the last lesson we covered numbers which had nothing after the decimal place. However, if we are going to work with calculations, we are going to constantly face situations where we have decimal places. In these instances we will use either floats or doubles:

let myFloat: Float = 1.025
let myDouble: Double = 1.025

As a definition, floats are floating point numbers which has a 32 bit representation and can have a precision of only 6 decimal places. A double is a floating point number that has a 64 bit representation and a precision of at least 15 decimal places, so when you have large numbers and require a higher degree of accuracy, you should use a double. When declaring these floating point numbers implicitly, the compiler will choose the floating point number most suitable to your system.

So if I type:

let floatingPoint = 1.01

Then start typing floatingPoint again, I can see in the code assistant that the compiler has declared it as a Double. This is important to note and may cause you issues if you did not realise this later on in your code.

Ok, so we have covered off the basics of numbers. In the next lesson we are going to talk briefly about type safety and casting..

Comments   

 
0 #113 Coreytax 2018-06-16 18:02
viagra headachekeyword buy viagra onlineviagra and lung problemscan i take viagra if i am on antibioticsatb viagra originalwhy doesnt viagra work for my husbandbest viagra type drugsviagra crea adiccionalcohol and viagraqual e o tempo de duracao do viagratraditional chinese viagracan i take viagra at 18
pfizer viagra viagra prices
viagra cheap levitra viagra tablets
sildenafil tablets online viagra pills
buy viagra in store viagra on line
photos of viagra usersviagra costs without insurancehow to use viagra pfizerbuy viagra online discreetlyviagra podobne preparatyque le pasa a las mujeres que toman viagratekst piosenki viagraviagra propecia buy onlinewhat happens if you snort a viagrawhat does it mean when viagra doesn workgeneric viagra in usaviagra voor vrouwen ervaringel viagra se puede comprar sin receta en chileviagra per erezionelangzeitschaden durch viagrarode bietensap viagrawat is viagra forviagra makes my face go redno2 e viagrafmale viagra
Quote
 
 
0 #112 Coreytax 2018-06-14 20:56
purchase of viagra viagra generic
getting viagra viagra tablets
best buy viagra http://viagraiy.com/#viagra-tablets-australia
Quote
 
 
0 #111 Coreytax 2018-06-13 13:56
2 doses of viagraefectos de la viagra wikipediaus viagra salesmovie parkinson's viagradonde comprar viagra en medellinviagra y micardisviagra sideffectsviagra pill ebayviagra presentacion de 50viagra warnings 4 hoursorder viagra from thailandcan you buy viagra in uk without prescriptionworks better viagra cialisfemigra (viagra para mujer)does viagra help workoutswhere to get viagra in new zealand
is it illegal to buy viagra online viagra
buy generic viagra viagra generic
how old do you have to be to buy viagra http://rldta.com/#buy-generic-viagra
other type of viagrarx viagra onlineviagra gyartojacan you take viagra with alcoholsex pill industry viagrajual viagra usa surabayahow much does viagra cost 2014sodium nitroprusside and viagraaverage age of viagra usersprix viagra boite de 8potenzmittel viagra cialis levitra & coviagra generika preis schweizviagra sperme zarar verir mivirtual viagra ? cure for impotence ? tutorial audiobook
Quote
 
 
0 #110 cialis tablets 2018-06-08 06:58
cialis taglich tadalafil 20 mg
buy name brand cialis on line tadalafil 20mg
cheap sildenafil tablets Viagra generico
buy prescription viagra online Viagra uk
cialis flussig http://cialisda.com/#tadalafil
viagra order online http://viabiovit.com/#viagra-20-mg
Quote
 
 
0 #109 cialis uk 2018-06-07 22:43
generic cialis at walmart online cialis
when will generic cialis be available purchasing cialis on the internet
buy viagra pill Viagra daily
cheapest viagra with prescription Viagra generic
cialis prices http://cialisb.com/#cialis-without-a-doctors-prescription
how can i buy viagra http://viabiovit.com/#viagra-tablets-australia
Quote
 
 
0 #108 Cialis 5 mg 2018-06-03 23:02
cialis tablets Cialis generico
cuanto cuesta cialis yaho Cialis 20mg
comprar cialis 10 espa241a http://babecolate.com/
Quote
 
 
0 #107 Generic for cialis 2018-06-03 19:18
5 mg cialis coupon printable Cheap cialis
viagra cialis levitra Buy cialis online
prices on cialis 10 mg http://babecolate.com/
Quote
 
 
0 #106 Tadalafil 2018-06-02 20:40
look here cialis cheap canada Cialis canada
canadian cialis Cialis tadalafil
40 mg cialis what if i take http://cialisiv.com/
Quote
 
 
0 #105 Cialis generic 2018-06-01 17:29
cialis uk next day Cialis generico
cialis prezzo di mercato Cialis online
cialis 10mg prix pharmaci http://cialisees.com/
Quote
 
 
0 #104 Generic for cialis 2018-06-01 13:56
cialis generico milano Cialis pills
cialis official site Best buy canada online
cialis from canada http://cialisees.com/
Quote
 

Add comment


Security code
Refresh