Possible error in MOD function

P

Peter K

Try typing the following ...

=MOD((1/(TAN(PI()/4-ATAN(120/119)))),1)

This produces the answer 1 in Excel 2000 and Excel 2003.
I think it should be zero, because the expression before the comma in MOD
equals -239

Peter K

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/com...dg=microsoft.public.excel.worksheet.functions
 
R

Ron Rosenfeld

Try typing the following ...

=MOD((1/(TAN(PI()/4-ATAN(120/119)))),1)

This produces the answer 1 in Excel 2000 and Excel 2003.
I think it should be zero, because the expression before the comma in MOD
equals -239

Peter K

Actually, Excel calculates the part before the comma as:

-239.000000000001

A formula like:

=MOD(ROUND((1/(TAN(PI()/4-ATAN(120/119)))),10),1)

does return 0
--ron
 
R

Ron Coderre

If I evaluate the formula segments in XL2003...

=MOD((1/(TAN(PI()/4-ATAN(120/119)))),1)

becomes this:
=MOD(-239.000000000001,1)

And the MOD is: 0.999999999999233

Since the binary math may be toying with you....
try this:

=MOD(ROUND(1/(TAN(PI()/4-ATAN(120/119))),5),1)
which results in 0.

Is that something you can work with?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top