The following problems are drawn from CSE 330 coursework. Each problem includes a complete worked solution. Try solving each one yourself before expanding the solution.
Problem 1: Form Types and Representable Ranges
Given β=2, m=3, and −2≤e≤1, find the minimum, maximum, and total count of representable positive numbers for each of the three forms below.
(a) Standard Form
x=±(0.d1d2d3)2×2e,d1=0⇒d1=1
Free digits:d2,d3∈{0,1} → 22=4 mantissas
Exponents:e∈{−2,−1,0,1} → 4 values
Minimum
(0.100)2×2−2=21×41=81
Maximum
(0.111)2×21=87×2=47
Total (positive)
22×4=16
Total (with sign)
16×2=32
(b) Normalized Form
In this form the leading digit after the radix point is 1 and no other digit is fixed. All three digits 0.1d1d2d3 vary, giving a wider set of representable mantissas.
x=±(0.1d1d2d3)2×2e
Minimum
(0.1000)2×2−2=21×41=81
Maximum
(0.1111)2×21=1615×2=815
Total (positive)
23×4=32
Total (with sign)
32×2=64
(c) Denormalized Form
x=±(1.d1d2d3)2×2e
The leading 1 is explicit; all three digits d1,d2,d3∈{0,1} are free → 23=8 mantissas.
Equivalently in the 0. style: (0.1d1d2d3)2×2e+1.
Minimum
(1.000)2×2−2=1×41=41
Maximum
(1.111)2×21=815×2=415
Total (positive)
8×4=32
Total (with sign)
32×2=64
Problem 2: Converting Decimal to Standard Floating-Point
Convert (6.25)10 to Standard floating-point representation with β=2, m=3, and −1≤e≤3.
Step 1: Convert 6.25 to binary:
6.25=4+2+0.25=(110.01)2
Step 2: Write in F-format (shift radix point left so the integer part becomes 0):
110.012=0.11001×23
Step 3: Round to m=3 mantissa digits.
The mantissa so far: 0.11001. We keep d1d2d3=110. The next digit is d4=0, so we truncate:
fl(6.25)=(0.110)2×23
Step 4: Verify:
(0.110)2×23=(21+41)×8=43×8=6.0
Rounding Error:
R.E.=∣6.25−6.0∣=0.25
Relative Error:
δ=6.25∣6.25−6.0∣=0.04
Problem 3: Floating-Point Multiplication
Given x=83 and y=85, find fl(x×y) using m=4 (Convention 1, β=2), and compute the rounding error.
Step 1: Convert to Standard Form:
x=83=(0.375)10=(0.011)2=(0.11)2×2−1
y=85=(0.625)10=(0.101)2×20
As m=4, so there is no need to round. Therefore, fl(x)=x=(0.11)2×2−1=83 and fl(y)=y=(0.101)2×20=85.
Step 2: Compute the exact product:
x×y=fl(x)×fl(y)=83×85=6415=0.234375
Step 3: Convert to binary F-format:
6415=(0.001111)2=(0.1111)2×2−2
The mantissa 0.1111 has exactly m=4 digits. Therefore, no rounding needed.
fl(x×y)=(0.1111)2×2−2=1615×41=6415
Rounding Error:
R.E.=6415−6415=0
No rounding error in this case since the exact result fits within m=4 digits.
Problem 4: Finding Machine Epsilon
Given β=2, m=4, −100≤e≤100, find the machine epsilon ξM using the IEEE Normalized Form.
For the Normalized Form:
ξM=21β−m
Substituting β=2, m=4:
ξM=21×2−4=21×161=321
Problem 5 — Quadratic Roots and Loss of Significance
Compute the roots of x2−12x+5=0 keeping four significant figures throughout. Show the Loss of Significance and apply the workaround.
Exact Roots (high precision)
x=212±144−20=212±124=6±31
x1=6+31≈11.5678x2=6−31≈0.43218
With 4 Significant Figures
A toy computer approximates 31≈5.568 (4 s.f., rounding 5.5677...).
x1=6+5.568=11.568→11.57✓ close to 11.5678
x2=6−5.568=0.4320→0.4320✗ actual: 0.43218
The subtraction 6−5.568 causes cancellation (1 leading digit lost), giving 3–4 digits of accuracy instead of 4.
(The error grows worse with more extreme cases(see Problem 2 analogue with 56x).)
Workaround Using Vieta’s Formulas
For x2−12x+5=0:
x1+x2=12,x1⋅x2=5
Step 1 — compute the stable root first (addition, no cancellation):
x1=6+5.568=11.57
Step 2 — recover x2 from the product:
x1⋅x2=5⟹x2=x15=11.575=0.4322
This matches the accurate value 0.43218 to 4 significant figures. The division completely avoids the catastrophic cancellation.