Skip to main content

2 posts tagged with "c"

View all tags

Understanding How Computers Store Floating-Point Numbers

· 2 min read
Apache Wangye
Software developer and technical writer

IEEE 754 represents a floating-point value as:

V = (-1)^s × M × 2^E

s: sign bit; 0 means positive and 1 means negative
M: significand represented as a binary fraction
E: exponent that scales the significand by a power of two

Floating-point values are finite approximations of real numbers. Many decimal fractions cannot be represented exactly in binary, which explains rounding errors, overflow, underflow, and why financial systems often use decimal or fixed-point arithmetic.

A Dangerous C Disk-Write Example and How to Study It Safely

· 2 min read
Apache Wangye
Software developer and technical writer

This early C exercise demonstrates how a program can open a Windows physical drive and overwrite its first sector.

Warning: the original code can corrupt critical disk structures, make the operating system unbootable, and cause permanent data loss. Do not run it on a real machine or any disk containing valuable data. It is retained here only as a security-education example. A safe exercise should replace the physical-drive path with an ordinary test file inside an isolated virtual machine.

Total views -- · Visitors --