liveBook · Manning

Multiplicative inverse

As explained in Modern C, Third Edition

A multiplicative inverse of a nonzero number is a number whose product with it equals one.

A multiplicative inverse of a nonzero number a is a number x such that a*x is one. In floating-point C, an approximation iteratively improves x until the product is sufficiently close to one. section 3.2

Heron approximation

Starting with x = 0.5 for a = 34.0, repeatedly update x with x *= (2.0 - a*x). Stop when fabs(1.0 - a*x) is below ε, the requested precision. A bounded loop can also guard against excessive iterations.

How Modern C, Third Edition covers it

How deep it goes
Explains the stopping test and update formula, but stops short of deriving Heron approximation mathematically.
Examples
Demonstrates inverses for 0.07, 5, and 6E+23, reporting approximations whose products approach one.
What it assumes
Assumes basic C expressions and loop syntax while teaching while-loop termination through a numerical computation.
What you can do after
Build it from scratch in C using scaling, Heron updates, precision checks, and iteration safeguards.
How it connects
Ties multiplicative inverses to while loops, do-while loops, floating-point precision, and loop termination.

Also explained in

Compare how 2 books explain multiplicative inverse →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Modern C, Third Edition. The section links point to the parts of the book it draws on.