Everything on the site.

Big-O notationAlgorithms · Count the steps in real loops, then compare n, n log n, n² and 2ⁿ on a live chart.RecursionAlgorithms · Watch frames push and pop on the call stack for factorial and Fibonacci.BFS vs DFSAlgorithms · A queue against a stack: draw a graph and see which order each search visits it in.Sorting algorithmsAlgorithms · Seven sorts on the same input, with comparison, swap and write counts side by side.Binary searchAlgorithms · Halve the range, probe the middle, repeat: with lo, mid and hi drawn on the array.Sets, relations and functionsDiscrete maths · Shade any set expression on a Venn diagram and test a relation for its properties.Proof by inductionDiscrete maths · Four worked proofs revealed one step at a time, and a broken one to diagnose.CombinatoricsDiscrete maths · An exact nPr and nCr calculator, and a Pascal’s triangle that shows its own addition rule.Boolean algebraDiscrete maths · The laws, De Morgan, and normal forms, with a truth-table generator built in.Finite-state machinesTheory · Build a DFA in a table, see it drawn, and run strings through it one symbol at a time.Domain theoryTheory · Why recursion needs least fixed points, and how CPOs, Scott continuity and powerdomains supply them.Truth table generatorTools · Expression in, truth table out: with DNF, CNF, a minimal form and LaTeX.Graph traversal visualiserTools · Draw a graph, then animate BFS, DFS and Dijkstra with the frontier shown.Recursion tree visualiserTools · Paste a recursive function or a recurrence and see its call tree and call count.Gradient descentML maths · Drag the starting point, set the learning rate, and watch it converge or blow up.Vectors and embeddingsML maths · Bend the plane with a 2×2 matrix and measure how close toy word vectors are.Softmax and cross-entropyML maths · Edit the logits and watch the probabilities, the loss and the gradient update live.Attention mechanismML maths · Q, K and V for three tokens, a live score heatmap, and the weighted sum of values.Image to video attentionML maths · One photo, 16 frames: switch reference attention on or off and watch the colours hold or drift.Formatting a CS paper in LaTeXLaTeX · Page limits, \documentclass, front matter, theorem environments and the bibliography.Camera-ready checklistLaTeX · Fonts embedded, PDF/A, copyright form, source bundle, and why final versions get rejected.LaTeX templatesLaTeX · Where the official classes live, plus a minimal article template you can copy.Boolean algebra calculatorTools · A Boolean expression simplifier that names the law used at every step.K-map solverTools · Fill in a Karnaugh map and see the groups, the minimal SOP and POS, and the essential terms.Logic gate simulatorTools · Wire up gates, flip the switches, and get the truth table and expression of your circuit.Regex to NFA converterTools · Type a regular expression and watch Thompson’s construction build its NFA, fragment by fragment.NFA to DFA converterTools · Enter an NFA or a regex and step through the subset construction, then minimise the DFA.DFA simulatorTools · Edit a DFA, run strings through it step by step, batch-test them and share the machine as a link.Regular expressions to automataTheory · Regex to NFA to DFA to minimal DFA, worked through on one example with every set shown.The halting problemTheory · Why no program can tell whether every program halts, with the paradox program played out.Pigeonhole principleDiscrete maths · n pigeons, k holes: why some hole gets ⌈n/k⌉, and the surprising things that follows from it.Dijkstra’s algorithmAlgorithms · Shortest paths with a priority queue: a worked table, a proof, and a graph you can redraw.Hash functionsAlgorithms · Keys in, buckets out: hash a word four ways, then watch chaining and probing handle collisions.Sorting algorithm visualizerTools · Up to seven sorts race on the same data, then step through any one of them line by line.LaTeX table generatorTools · Type or paste a table, merge cells, pick booktabs, and copy clean tabular code.Combination calculatorTools · Exact nCr with the cancelling shown, combinations with repetition, and a full list for small n.Permutation calculatorTools · nPr, nʳ, anagrams like MISSISSIPPI and round-table seatings, with exact working.AVL tree visualizerTools · Insert, delete and search, then replay every balance factor and rotation step by step.IEEE 754 converterTools · Decimal to float bits and back, with the exact stored value and why 0.1 isn’t exact.Two’s complement calculatorTools · Signed integers to bits and back, with the working, other encodings and overflow checks.Power set calculatorTools · Every subset of your set, sorted by size or bitmask, with 2ⁿ counted exactly.Huffman coding calculatorTools · Text or frequencies in, Huffman tree and codes out, with every merge shown in order.LaTeX matricesLaTeX · pmatrix, bmatrix, augmented and large matrices, each with copyable code and its result.AlgorithmsSection · Step-through visualisations of sorting, searching, recursion, graph traversal, Dijkstra’s algorithm, hash functions and Big-O growth, with pseudocode that follows along.Discrete mathsSection · Sets, relations and functions, proof by induction, counting, the pigeonhole principle and Boolean algebra, explained with worked examples and interactive checkers.TheorySection · Finite-state machines, regular expressions and automata, the halting problem, and the mathematical semantics of programming languages, explained from first principles.ML mathsSection · Gradient descent, vectors and embeddings, softmax, attention and image to video models, each with a formula, a worked numeric example and a live version.ToolsSection · Free browser tools: truth tables, K-maps, logic gates, nCr, power sets, regex to DFA, sorting, graph and AVL tree visualisers, IEEE 754, two’s complement and Huffman codes.LaTeXSection · How to format a CS conference or workshop paper in LaTeX, a camera-ready checklist, a minimal template you can adapt, and how to typeset matrices.
Free tool

IEEE 754 converter: float to binary and hex, and back

Convert a decimal number to its IEEE 754 floating-point bits, or bits back to a number, in single (32-bit) or double (64-bit) precision. The converter colours the sign, exponent and mantissa, shows the exact value that is actually stored, and explains every step. Click any bit to flip it.

Interactive: Float converter with clickable bits and workingUpdated

IEEE 754 converter

Bits (click any bit to flip it)

  • Sign (1 bit)
  • Exponent (8 bits)
  • Fraction (23 bits)

Step-by-step working

    How a floating-point number is stored

    IEEE 754 is the standard nearly every processor and programming language uses for non-integer numbers: float and double in C, C++, Java and C#, f32 and f64 in Rust, and every JavaScript number. It writes a number in binary scientific notation,

    x=(−1)s×1.f×2E,x = (-1)^{s} \times 1.f \times 2^{E},

    and packs the three parts into one word of bits:

    FormatSignExponentFraction (mantissa)BiasDecimal digits
    Single precision (binary32)1823127about 7
    Double precision (binary64)111521023about 15–17
    • Sign bit ss: 0 for positive, 1 for negative.
    • Exponent field: the power of two EE plus a fixed bias (127 or 1023), stored as an unsigned integer. The bias lets the field hold negative exponents without a sign bit, and makes bit patterns of positive floats sort in the same order as their values.
    • Fraction field: the bits after the binary point of the significand 1.f1.f. A normalised binary number always starts with 1, so that 1 is not stored. This “hidden bit” gives single precision 24 bits of precision from 23 stored ones.

    Converting decimal to IEEE 754 by hand

    Worked example: −6.25 in single precision

    1. Sign. The number is negative, so s=1s = 1.
    2. Binary. 6 is 110 and 0.25 is .01, so 6.25 = 110.012110.01_2.
    3. Normalise. Move the point two places left: 110.012=1.10012×22110.01_2 = 1.1001_2 \times 2^{2}, so E=2E = 2.
    4. Bias the exponent. 2+127=1292 + 127 = 129, which is 10000001 in 8 bits.
    5. Fraction. Drop the leading 1 and pad the rest, 1001, with zeros to 23 bits.
    6. Assemble: 1 10000001 10010000000000000000000, which is 0xC0C80000 in hex.

    For fractions, convert by repeated doubling: multiply the fractional part by 2, write down the integer digit (0 or 1), and continue with what is left. 0.25 → 0.5 (digit 0) → 1.0 (digit 1), stop. Some fractions never stop, and that is where rounding comes in.

    Why 0.1 can’t be stored exactly

    Doubling 0.1 gives 0.2, 0.4, 0.8, 1.6, 1.2, 0.4, 0.8, … and the digits 0001 1001 1001 1001 … repeat for ever, just as 1/3 = 0.333… does in decimal. Only fractions whose denominator is a power of two have finite binary expansions. So 0.1 has to be rounded to the nearest number that fits:

    • In single precision 0.1 is stored as 0x3DCCCCCD, which is exactly 0.100000001490116119384765625, an error of +0.000000001490116119384765625.
    • In double precision it is 0x3FB999999999999A, exactly 0.1000000000000000055511151231257827021181….

    Those tiny errors explain the most famous floating-point surprise. In JavaScript or Python, 0.1 + 0.2 prints 0.30000000000000004, and 0.1 + 0.2 == 0.3 is false: both inputs were rounded up slightly, the sum is rounded again, and the result lands on the double just above the one nearest 0.3. Type 0.3 and 0.30000000000000004 into the converter in double precision and compare the bits: they differ in the last place.

    What this means in code Never test floats for exact equality after arithmetic; compare with a tolerance such as Math.abs(a − b) < 1e-9 * Math.max(1, Math.abs(a), Math.abs(b)). And never store money in binary floats: use integer cents or a decimal type.

    Rounding: round to nearest, ties to even

    When a value falls between two representable numbers, IEEE 754 by default picks the nearer one. On an exact tie it picks the one whose last fraction bit is 0 (“ties to even”), which avoids the steady upward drift that always rounding halves up would cause. You can see this at 224+12^{24} + 1 = 16,777,217: single precision has 24 significant bits, so integers above 2242^{24} are spaced 2 apart. 16,777,217 sits exactly halfway between 16,777,216 and 16,777,218 and rounds to the even one, 16777216. That is why a 32-bit float can’t count past 16,777,216 one by one.

    The gap between neighbouring floats is called a unit in the last place (ulp). It doubles every time the exponent goes up by one, so floats are dense near zero and sparse for huge values. The converter shows the next value up and down for whatever you type. The ulp of 1 is 2−23≈1.19×10−72^{-23} \approx 1.19 \times 10^{-7} in single precision and 2−52≈2.22×10−162^{-52} \approx 2.22 \times 10^{-16} in double; this is machine epsilon.

    Special values

    The smallest and largest exponent fields are reserved:

    Exponent fieldFractionMeaning
    All zerosZero±0. There are two zeros; they compare equal, but 1/−0=−∞1/{-0} = -\infty.
    All zerosNon-zeroSubnormal: no hidden 1, exponent fixed at 1−bias1 - \text{bias}. They fill the gap between 0 and the smallest normal number, so x−y=0x - y = 0 only when x=yx = y.
    All onesZero±∞, the result of overflow or of dividing a non-zero number by zero.
    All onesNon-zeroNaN (not a number), from 0/00/0, ∞−∞\infty - \infty or −1\sqrt{-1}. A NaN is not equal to anything, including itself.

    Range of single and double precision

    Single (float)Double
    Largest finite0x7F7FFFFF ≈ 3.4028235 × 10³⁸0x7FEFFFFFFFFFFFFF ≈ 1.7976931 × 10³⁰⁸
    Smallest normal0x00800000 = 2⁻¹²⁶ ≈ 1.18 × 10⁻³⁸2⁻¹⁰²² ≈ 2.23 × 10⁻³⁰⁸
    Smallest subnormal0x00000001 = 2⁻¹⁴⁹ ≈ 1.4 × 10⁻⁴⁵2⁻¹⁰⁷⁴ ≈ 4.9 × 10⁻³²⁴
    Machine epsilon2⁻²³ ≈ 1.19 × 10⁻⁷2⁻⁵² ≈ 2.22 × 10⁻¹⁶
    Exact integers up to2²⁴ = 16,777,2162⁵³ = 9,007,199,254,740,992

    The last row is why JavaScript’s Number.MAX_SAFE_INTEGER is 253−12^{53} - 1: beyond it, not every integer has a double, so database IDs and 64-bit counters must be handled as strings or BigInt.

    Using the converter

    • Decimal input accepts ordinary numbers, scientific notation (6.02e23), Infinity, -0 and NaN. The working then shows the encoding steps, and the rounding error compares the exact stored value with exactly what you typed.
    • Bit input: type 0x followed by up to 8 (single) or 16 (double) hex digits, or all 32 or 64 binary digits; spaces are ignored. The working then decodes the bits.
    • Exact value is computed with arbitrary-precision integers, so it is the true stored value to the last digit, not another rounded float.
    • Integers are stored differently, in two’s complement; see the two’s complement calculator.

    References

    1. IEEE Computer Society, IEEE Standard for Floating-Point Arithmetic, IEEE Std 754-2019.
    2. D. Goldberg, “What every computer scientist should know about floating-point arithmetic”, ACM Computing Surveys 23(1), 1991, 5–48.
    3. R. E. Bryant and D. R. O’Hallaron, Computer Systems: A Programmer’s Perspective, 3rd ed., Pearson, 2016. Section 2.4.
    4. N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed., SIAM, 2002. Chapter 2.