DevTools Logo

Bitwise & IEEE-754 Explorer

Bitwise & IEEE-754 Explorer

See floating-point bits and perform 32-bit operations locally in your browser.

Number input

Decimal or hexadecimal (0x…) values are accepted.

32-bit bitwise operation

Examples

Encode 1 and 0.1 in f32

Input
analyzeFloat(1, "f64")
analyzeFloat(0.1, "f32")
Output
f64 bits: 0011111111110000000000000000000000000000000000000000000000000000 (normal, unbiased exponent 0)
f32 bits: 00111101110011001100110011001101 (normal, roundedValue 0.10000000149011612)

1.0 is the canonical biased-exponent example; 0.1 shows f32 quantization through the DataView round trip.

Mask and rotate 32-bit words

Input
applyBitwise("AND", "0xf0", "0x0f") // 0
rotate32("0x80000001", 1, "left") // 3
Output
AND result: 0 (0x00000000)
Rotate-left result: 3 (0x00000003)

Operands are normalized with >>> 0 first; rotation wraps the high bit around instead of discarding it like shift32 does.

About this tool

Bitwise IEEE-754 Explorer encodes a JavaScript number into its exact IEEE-754 bit pattern with analyzeFloat, using a big-endian DataView for either binary32 (f32, 1 sign + 8 exponent + 23 mantissa bits) or binary64 (f64, 1 + 11 + 52 bits). It splits the bit string into sign, exponent, and mantissa fields, reports the raw exponent value alongside the unbiased exponent (raw minus a bias of 127 for f32 or 1023 for f64), and classifies the value as zero, subnormal, normal, infinity, or NaN from the exponent and mantissa fields. For f32 it also returns roundedValue, the float32 value read back through the DataView, so precision loss such as 0.1 becoming 0.10000000149011612 is visible directly.

The same module provides unsigned 32-bit integer logic through toUint32, which coerces finite numbers with >>> 0 and parses strings with parseNumericInput (leading/trailing whitespace trimmed, /^[-+]?0x[0-9a-f]+$/i inputs via parseInt base 16, everything else via Number, throwing on empty or NaN input). applyBitwise implements AND, OR, XOR, and NOT with >>> 0 normalization, so NOT 0 yields 0xFFFFFFFF and negative inputs such as -1 become 0xFFFFFFFF before the operation. Non-finite inputs are rejected with an explicit error because 32-bit operations require a finite number.

Shifts and rotates operate on the same 32-bit domain with the shift amount normalized by Math.trunc(amount) & 31, so an amount of 32 is a no-op rather than a full rotation. shift32 is a logical shift (left via (bits << shift) >>> 0, right via bits >>> shift with zero fill), while rotate32 wraps the bits that fall off one end onto the other. formatHex32 renders 0x plus eight lowercase hex digits and formatBinary32 renders a 32-character zero-padded binary string, giving canonical display forms for masks, flags, and encoded floats.

How to use this tool

  1. Encode a float

    Enter a decimal value and choose f32 or f64. Read the 32- or 64-bit pattern, the separated sign/exponent/mantissa fields, the unbiased exponent, and the classification; for f32 compare roundedValue against the input to see quantization.

  2. Probe special values

    Enter -0, Infinity, NaN, Number.MIN_VALUE, or Number.MAX_VALUE to see signed zero (sign bit 1, classification zero), all-ones exponents for infinity/NaN, the minimum subnormal bit pattern, and f32 overflow of DBL_MAX to infinity.

  3. Run 32-bit integer logic

    Supply decimal or 0x-prefixed hex operands for AND, OR, XOR, or NOT. Operands are coerced with >>> 0 first, so verify the hex and binary renderings before trusting a mask result.

  4. Shift, rotate, and format

    Apply shift32 or rotate32 with an integer amount (masked to 0-31, truncated toward zero), then read the result with formatHex32 or formatBinary32 for pasting into code or documentation.

Use cases

Explaining float precision bugs

Show why 0.1 + 0.2 !== 0.3 by exposing the f32/f64 mantissa truncation and the roundedValue readback.

Debugging bit masks and flags

Verify AND/OR/XOR/NOT mask logic and shift/rotate amounts on canonical hex and 32-bit binary renderings before committing protocol or permission code.

Teaching IEEE-754 layout

Demonstrate sign, biased exponent, subnormal vs normal vs infinity/NaN, and signed zero using exact DataView-encoded bit strings.

Common mistakes

Mistake:Feeding Infinity or NaN into the 32-bit bitwise path.

Fix:Convert only finite numbers: toUint32 throws on non-finite input. Inspect infinities and NaN with analyzeFloat, which classifies them from the exponent field, instead.

Mistake:Expecting shift amounts of 32 or more to clear or move the word.

Fix:The amount is masked with & 31 after truncation, so 32 is a no-op. Reduce the amount modulo 32 explicitly when reasoning about large shifts.

Mistake:Assuming f32 output equals the input decimal.

Fix:Read roundedValue: f32 stores only 23 mantissa bits, so values like 0.1 quantize. Use f64 when the decimal must round-trip exactly.

Frequently asked questions

What does this tool do?

It encodes a number into its exact IEEE-754 binary32 or binary64 bit pattern (sign, exponent, mantissa, unbiased exponent, and zero/subnormal/normal/infinity/NaN classification) and it evaluates unsigned 32-bit AND, OR, XOR, NOT, logical shifts, and rotates with canonical hex and binary rendering.

Why does f32 show a different value than what I typed?

binary32 keeps only 23 mantissa bits, so decimals like 0.1 quantize — the tool reports roundedValue read back through the DataView (0.10000000149011612) next to the 32-bit pattern 00111101110011001100110011001101. Switch to f64 when the decimal must round-trip, and note that Number.MAX_VALUE overflows to infinity in f32.

Is my input uploaded or stored?

No. Encoding uses the browser's DataView and the integer logic is plain >>> 0 arithmetic — everything runs 100% client-side and nothing you enter leaves your device.

How do I read shift versus rotate results?

Both mask the amount with Math.trunc(amount) & 31, so 32 is a no-op. shift32 discards bits (0x80000001 left by 1 gives 2), while rotate32 wraps them (same input gives 3); formatHex32 and formatBinary32 show the result as 0x-padded hex and 32-bit binary.

References & standards

.env Secret Safety Linter

Validate .env syntax and spot likely leaked credentials or placeholder secrets.

.htaccess Generator

Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth

2D Fluid Dynamics & Particle Physics Sandbox

A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.

AI Function Calling Schema Generator

Generate function calling JSON schemas from TypeScript interfaces

Algorithm Arena & Data Structure Visualizer

Interactive arena for algorithms and data structures: eight sorting algorithms racing on one seeded input, six pathfinding algorithms walking generated mazes, and BST, AVL, Red-Black, B-tree, heap and trie operations replayed step by step with rotations highlighted. Every run shows the Big-O table and the phase-highlighted reference implementation in four languages, and compared values can be played as pitch (sonification) through the shared audio engine. Everything runs client-side; inputs never leave the browser.

Ansible Playbook Generator

Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML