To convert the decimal fraction 0.625 to binary, the exact answer is 0.101. The standard formula relies on successive multiplication by 2: (0.625 × 2 = 1.25, record 1, keep 0.25), (0.25 × 2 = 0.5, record 0, keep 0.5), and (0.5 × 2 = 1.0, record 1, keep 0). However, on the workbench, converting decimal fraction to binary isn't just a textbook math exercise; it dictates how your microcontroller's ADC (Analog-to-Digital Converter) or DAC maps normalized sensor readings to physical electrical realities.

The Core Math and the Assumptions That Fix the Answer

In pure mathematics, 0.625 is exactly 0.101 in base-2. But in embedded electrical systems, the assumption that fixes the answer is your bit-depth and register width. A theoretical 3-bit system stops at 0.101. However, microcontrollers do not process raw binary fractions; they scale them to integer registers.

Inline Data Highlight: If your normalized sensor reading is 0.625, the binary integer representation shifts based on your hardware:
10-bit ADC (Arduino Uno): 0.625 × 1023 = 640 (Binary: 1010000000)
12-bit ADC (ESP32): 0.625 × 4095 = 2559 (Binary: 100111111111)
IEEE 754 32-bit Float: Stored as 0 01111110 01000000000000000000000

When writing firmware for power monitoring, you must explicitly define whether your variables are fixed-point integers or floating-point numbers. Using standard floats on an 8-bit AVR chip introduces massive computational overhead, whereas fixed-point integer math requires you to manually track the implied binary point.

Neighboring Values and ADC Scaling Table

When calibrating a voltage sensor like the ZMPT101B module, you rarely hit exact fractions. Below is a reference table showing a ±20% range around our 0.625 anchor (0.500 to 0.750), mapping the decimal fraction to its pure binary form and the resulting 12-bit ADC integer register value (assuming a 3.3V reference and 0-4095 scale).

Decimal Fraction Pure Binary Fraction 12-Bit ADC Integer 12-Bit Binary Register
0.5000 0.1000 2048 100000000000
0.5625 0.1001 2303 100011111111
0.6250 (Anchor) 0.1010 2559 100111111111
0.6875 0.1011 2815 101011111111
0.7500 0.1100 3071 101111111111

How the Mapping Shifts for 120V vs 230V vs 3-Phase Systems

If your decimal fraction represents a normalized AC mains waveform reading, the binary target value in your firmware's DAC or PWM control loop shifts drastically depending on the physical system you are monitoring or driving. The fraction itself (e.g., 0.625 representing 62.5% of the peak waveform) remains mathematically constant, but the physical scaling factor applied to it changes based on the nominal voltage and crest factor.

  • 120V Nominal Systems: The peak voltage is roughly 170V. A decimal fraction of 0.625 represents 106.25V. If you are generating a synthetic sine wave via a DAC, the binary register value maps to this 106V instantaneous threshold.
  • 230V Nominal Systems: The peak voltage is roughly 325V. That same 0.625 fraction now represents 203.1V. To trigger an over-voltage protection relay at this exact point in the waveform, your comparator threshold in firmware must be scaled to the 230V reference, even though the underlying binary fraction math is identical.
  • 3-Phase 400V Systems: Line-to-line peak voltage reaches approximately 565V. Here, the 0.625 fraction equates to 353V. Furthermore, 3-phase systems require tracking three separate fractional offsets (120 degrees apart). Converting a single decimal fraction to binary is insufficient; you must maintain three distinct binary-scaled lookup tables in your microcontroller's SRAM to handle the phase shifts.

According to Espressif's ESP-IDF ADC documentation, when sampling these higher voltage systems via voltage dividers, you must also account for the non-linearity of the ADC at the extremes of the rail, meaning a theoretical 0.750 fraction might actually read as 0.735 in raw binary without software calibration.

When the Conversion is Meaningless (The Power Factor Trap)

There is a specific scenario in power electronics where converting a decimal fraction to binary for control purposes is practically meaningless: when the Power Factor (PF) is unknown.

Suppose you are building a smart inverter and you calculate a decimal fraction representing the load's apparent power (e.g., 0.800, meaning 80% of maximum capacity). If you convert this 0.800 fraction directly into a binary PWM duty cycle to drive your IGBT gates, you are assuming a purely resistive load (PF = 1.0). If the actual load is highly inductive (like an uncompressed AC motor with a PF of 0.6), the real power is significantly lower. Your binary PWM mapping will overdrive the inverter's thermal limits because the decimal fraction represented apparent power (kVA), not real work (kW). Always ensure your decimal fraction is derived from true RMS calculations that account for phase angle before converting it to binary control registers.

Frequently Asked Questions

How do you convert a repeating decimal fraction to binary?

Repeating decimals in base-10 (like 0.333...) often become repeating fractions in base-2 as well. To convert them, you apply the same successive multiplication by 2 method, but you must enforce a hard stop based on your hardware's bit-depth. For example, on a 12-bit system, you stop multiplying after 12 iterations and truncate or round the final bit. Attempting to store an infinitely repeating binary fraction in a microcontroller will result in an infinite loop or a buffer overflow.

Why does my ESP32 ADC output a different binary value than my math predicts?

The ESP32's internal 12-bit ADC is notorious for non-linearity, particularly near the 0V and 3.3V rails. If your math predicts a decimal fraction of 0.900 (binary integer 3685), the actual silicon might return 3550 due to internal attenuation and noise. As noted in Analog Devices' technical articles on data converters, you must implement a software lookup table (LUT) or a multi-point polynomial calibration curve in your firmware to map the raw, flawed binary integers back to accurate decimal fractions.

What is the difference between fixed-point and IEEE 754 floating-point binary fractions?

Fixed-point binary treats the integer as a whole number and assumes an implied decimal point at a specific bit position (e.g., Q15 format uses 15 bits for the fraction). It is extremely fast and uses minimal CPU cycles, making it ideal for high-speed PWM control loops. IEEE 754 floating-point dedicates specific bits to a sign, an exponent, and a mantissa, allowing it to handle massive dynamic ranges (like calculating both milliamp leakage and kiloamp fault currents in the same script), but it requires a hardware Floating Point Unit (FPU) to execute efficiently without stalling the processor.