user3450025
user3450025

Reputation: 1

Floating point system

there exists a floating point system (B, T, L, U) (B=base, T=number of digits, L=lower exponent, U=upper exponent) where pi is exactly represented? And for the number 8/7?

Upvotes: 0

Views: 143

Answers (2)

Stephen Canon
Stephen Canon

Reputation: 106167

Of course there does. In base-pi floating-point, pi is exactly 10.0.

Upvotes: 1

Mark Dominus
Mark Dominus

Reputation: 1808

There is not. The floating-point systems you are considering can only represent numbers of the form k· B^n, where k and n are integers. All these numbers are rational, but π is irrational.

For a floating point system that can exactly represent 8/7, you need B to be a multiple of 7, in which case it is easy; you write it as 8·7^{-1}.

Upvotes: 1

Related Questions