liveBook · Manning

Heron approximation

Heron approximation is an iterative numerical method that refines an estimate of a square root or related reciprocal quantity.

How 2 Manning books explain it

Modern C

The Heron approximation is an iterative numerical method for computing the multiplicative inverse of a number.

How it is used
Demonstrates while and do iteration through a practical floating-point inverse calculation.
How deep it goes
Explains the update and stopping test with code, but defers the numerical derivation.
Examples
Uses a = 34.0, x = 0.5, an epsilon threshold, and complete C listings with sample inverse results.
What you can do after
Apply it via C loop constructs to compute approximate multiplicative inverses with a chosen precision threshold.

Read how Modern C explains Heron approximation →

Modern C, Third Edition

The Heron approximation is an iterative numerical method for refining an estimate of a reciprocal or square-root-related quantity.

How it is used
Uses reciprocal approximation to demonstrate while, do, break, and continue iteration in C.
How deep it goes
Explains the update and convergence test, then shows scaling, bounded refinement, and alternate loop forms.
Examples
Uses a = 34.0, initial x = 0.5, a complete inverse program, and outputs for 0.07, 5, and 6E+23.
What you can do after
Apply it via C while, do, or break-based loops to compute multiplicative inverses to a chosen tolerance.

Read how Modern C, Third Edition explains Heron approximation →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.