Thread Subject: division question - EASY

Subject: division question - EASY

From: mp

Date: 20 Oct, 2005 16:24:22

Message: 1 of 5

How can I get a division like 8570833 /8570834 to give me an accurate
answer, .999999883, and not simply 1.000, which is what I am getting?

Subject: division question - EASY

From: ChiChiRuiz@gmail.com

Date: 20 Oct, 2005 13:21:31

Message: 2 of 5

Try making them type "long" parameters.

Subject: division question - EASY

From: us

Date: 20 Oct, 2005 16:29:00

Message: 3 of 5

mp:
<SNIP display format evergreen...

> How can I get a division like 8570833/8570834 to give me an
accurate answer, .999999883...

one of the solutions (setting the next evergreen - FP issues - aside
for now)

     format long g
     8570833/8570834
% ans = 0.99999988332524

us

Subject: division question - EASY

From: PB

Date: 20 Oct, 2005 16:31:41

Message: 4 of 5

mp wrote:
>
>
> How can I get a division like 8570833 /8570834 to give me an
> accurate
> answer, .999999883, and not simply 1.000, which is what I am
> getting?

It is a matter of display, not accuracy. Try format long or use
fprintf.

a=8570833 /8570834
format long
a
%or
fprintf('%.16f\n',8570833/8570834)

HTH

PB

Subject: division question - EASY

From: mp

Date: 20 Oct, 2005 16:36:24

Message: 5 of 5

THANKS!

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com