Browse by Topic

Popular

Latest

Latest Posts

Illustration of two floating-point numbers being compared with a tolerance threshold, showing a close-up of a scale and a checkmark.
Python

Python Float Comparison: How to Compare Floats Correctly

python float comparison: Learn why direct float equality fails and how to compare floats reliably using tolerance, math.isclose, and practical testing strategies.

floating pointmath.isclosetoleranceunit testing
Illustration of a Python float being approximated by a binary fraction, showing the gap between decimal and binary representation.
Python

Python Float Precision: Handling Rounding Errors

Python floats are binary approximations. Understand why operations like `0.1 + 0.2` can be inexact, how to inspect the stored value, and when to use Decimal.

float precisionIEEE 754Decimal modulerounding errors
Editorial thumbnail showing a number line where 0.1 plus 0.2 lands slightly past 0.3, illustrating floating point precision error.
Python

Python Floating Point: Precision, Errors, and Fixes

Learn why 0.1 + 0.2 is not 0.3 in Python, how binary floating point works, and how to compare, round, and choose the right numeric type.

floating-pointnumeric-precisiondecimal-moduleieee-754
Diagram of a Python float showing its binary representation with precision boundaries and a magnifying glass highlighting rounding error.
Python

Python Float Usage: Precision, Comparisons, Formatting

Learn practical Python float usage: precision limits, safe comparisons, formatting, conversions, and when to use Decimal.

pythonfloatprecisiondecimal
A diagram showing a Python integer growing beyond 64 bits into multiple digit blocks, illustrating arbitrary precision.
Python

Python Arbitrary Precision Integers Explained

Explains how Python's arbitrary precision integers work, highlights their performance and memory costs, and describes when fixed-width numeric types are the better choice.

arbitrary precisioninteger arithmeticCPython internalsnumeric types
Python code showing int() with base parameter converting binary and hexadecimal strings to decimal integers.
Python

Python int Base Conversion: Using int() with Different Bases

python int base conversion: Learn how Python's int() converts strings and numbers between bases, with syntax, error handling, and edge cases for base 2 to 36.

int()base conversionradixnumber parsing
Diagram showing conversion between a Python integer and its hexadecimal string representation.
Python

Python Hexadecimal Integer: Conversion and Formatting

Practical Python guide to converting integers to and from hexadecimal strings, formatting hex output, and using bitwise operations.

pythonhexadecimalinteger-conversionbitwise-operations
Stylized 0o755 octal literal with an arrow to its decimal equivalent 493, illustrating Python octal integer syntax.
Python

Python Octal Integer: Syntax, Conversion, and Pitfalls

Learn the python octal integer syntax in Python 3: the 0o prefix, conversions with oct() and int(), and the leading-zero SyntaxError.

octal-literalspython-syntaxnumeric-conversionfile-permissions
Illustration of a Python binary integer showing bit positions and bitwise operations
Python

Python Binary Integer: Bits and Bitwise Operations

Learn how Python represents integers in binary, how bitwise operators behave, and how to use them for practical bit manipulation.

bitwise operationsinteger representationtwo's complementbit manipulation
Illustration of a Python integer 42 transforming into a string '42' with a code editor background.
Python

Python Int to String: Convert and Format Integers

Understand how to convert Python integers to strings with str(), f-strings, and format(). Compare behavior, formatting options, and edge cases.

pythonstring-conversionf-stringsformat-specifiers