0% found this document useful (0 votes)
25 views

Real Number Data Types

This document discusses data types for representing real numbers in C#. It covers floating point numbers like float and double, which can represent a large range of real numbers but with some inaccuracy. It also discusses decimals, which can represent real numbers exactly but have a smaller range than float. The goal is to understand different data types for real numbers and their tradeoffs.

Uploaded by

Luca Kab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Real Number Data Types

This document discusses data types for representing real numbers in C#. It covers floating point numbers like float and double, which can represent a large range of real numbers but with some inaccuracy. It also discusses decimals, which can represent real numbers exactly but have a smaller range than float. The goal is to understand different data types for real numbers and their tradeoffs.

Uploaded by

Luca Kab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Module 3

Data Types, Variables, and


Constants

Lecture
Real Numbers Data Types

Module 3 Learning Objectives


In this lecture, well discuss the various data types
we use to represent real numbers in C#
Discuss the problem of approximating the
continuous domain, with an infinite number of
numbers between 0 and 1, in the discrete domain
using binary

Floating point numbers
f l oat , doubl e
Different number of
bits in memory for
each type
What does that tell us?
Operations are all as
youd expect
In-Lecture Quiz

Floating point numbers are useful because they
represent a large range of real numbers, but they
come with some
A: inaccuracy
B: sadness
C: pain and suffering
D: loss of health


deci mal
Perfect accuracy
Smaller range of
numbers than f l oat
Operations are all as
youd expect
In-Lecture Quiz

Decimals are useful as a data type because

A: we can use variables
B: we can represent real numbers exactly
C: we can use constants
D: Dr. T is the hippest cat in the land, and if he says so
its good enough for me



Recap
C# provides a variety of data types for representing
real numbers
Next Time
Other value types

You might also like