### Edmonton Python User Group

Web: EdmontonPy.com

## alberta.ca/covid19

When standing as a group of people, always leave room for 1 person to join your group.

# Jobs

### Online

Looking for a job? Looking to hire great people?

# Python Tip

``````# Floating point arithmetic
print(0.1 + 0.1 + 0.1 == 0.1 * 3)  # True

print(0.1 + 0.1 + 0.1 == 0.3)  # False
print(0.1 * 3 == 0.3)          # False

# For exact decimal arithmetic, we use the decimal module
# and Decimal class
from decimal import Decimal

one_tenth = Decimal("0.1")  # For brevity's sake

# All 3 return True
print(one_tenth + one_tenth + one_tenth == one_tenth * 3)
print(one_tenth + one_tenth + one_tenth == Decimal("0.3"))
print(one_tenth * 3 == Decimal("0.3"))

# But you can't mix Decimal and floating point!
print(Decimal("24.99") * 1.05)
# TypeError: unsupported operand type(s) for *:
# 'decimal.Decimal' and 'float'``````

Floating Point vs Decimal

# Next Meetup

## May...be?

(We're going to try to make it happen, 🤞)

Paul Duerr

Daniel Mouris

By EdmontonPy

# April 2020

EdmontonPy met online on April 15, 2020 at 7PM MDT. These are their slides!

• 42