Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 11781

What does "~=" means in a Python expression?

$
0
0

So, I'm casually following along in JupyterLab to:

https://docs.python.org/release/3.10.0/tutorial/floatingpoint.html

Then we come across this segment:

1 / 10 ~= J / (2**N)type here

only for this output:

Cell In[19], line 11 / 10 ~= J / (2**N)           ^SyntaxError: invalid syntax

Now, it may have been about 20+ years since this has been updated.

Paragraph 3:

Why is that? 1/10 is not exactly representable as a binary fraction. Almost all machines today (November 2000) use IEEE-754 floating point arithmetic, and almost all platforms map Python floats to IEEE-754 “double precision”.

What did "~" get replaced with since November 2000, in Python?


Viewing all articles
Browse latest Browse all 11781

Trending Articles