GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — programmingWithPythonCode/simple_datatypes/float_nan.py at main · thomasWeise/programmingWithPythonCode

Expand file tree

/

float_nan.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
18 lines (17 loc) · 824 Bytes
/

float_nan.py

Copy path

File metadata and controls

18 lines (17 loc) · 824 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from math import inf
inf - 1 # infinity - 1 is still infinity
inf - 1e300 # infinity - big number is still infinity
inf - inf # infinity - infinity is undefined == nan
inf / 1e300 # infinity / big number is still infinity
inf / inf # infinity / infinity is still infinity
0 * inf # 0 * infinity is undefined == nan
from math import nan
nan + 1 # undefined + anything = undefined
nan + inf # undefined + anything = undefined
nan == 1 # undefined does not equal anything
nan != 1 # undefined is unequal to anything
1 != 1 # this is obviously False
nan == nan # undefined does not equal anything, including itself
nan != nan # undefined is unequal to anything, including itself
inf == inf # infinity equals infinity
inf != inf # infinity therefore does not "not equal" infinity
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.