ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Possible error in MOD function (https://www.excelbanter.com/excel-worksheet-functions/177629-possible-error-mod-function.html)

Peter K[_2_]

Possible error in MOD function
 
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/comm...et.f unctions

Ron Rosenfeld

Possible error in MOD function
 
On Fri, 22 Feb 2008 17:18:00 -0800, Peter K <Peter
wrote:

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

Ron Coderre

Possible error in MOD function
 
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)



"Peter K" <Peter wrote in message
...
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/comm...et.f unctions





All times are GMT +1. The time now is 02:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com