I’m getting an odd error, and I wonder if someone can tell me why.
When I use expr, the result of 1200.0/log(2.0) is 1731.234009
but when I do the same calculation in python or in C, the result of 1200.0/log(2.0) is 1731.234049
I know the error is small, but why is it occurring?
Max code (6.1.1) is pasted below.
----------begin_max5_patcher---------- 379.3ocoSEjSCCCD7bxqvZOARgPbPjV3FuCTUkShaqqRsibbJAp5eG60IzVn PiJWr0Nd85Ymc7tv.HW0wa.xyjWIAA6BCBPHGPPeb.rg0UTwZvzfEUJY6FHx ezBkzzH9f6NhlFmzCayPHq3F7JzCfpVy.ZZOZMyTrRHWNWyKLdhPSmXqDg9T FtM4A2VJMNgLq+RhRjKp702M8XpHYaPp.unErJ3qmPawMb8btjkWgYLvTOiL uWy8usq+XFHh.4L4RfLyk19vP2RzHkn7ViQIgwqEzKqEn3RRSFVOmTjA+VSc 88hj+lszCE1v6PdA7tZskaIIwj6IUpk2jFe6+2SLBc3QumHM6u7DzK6I9gDc p7fUEpDxu+4.olC+TMqQ0pKFJU+rfbfak7FiPxLBqs3PNzSxYknrjKO1aVJZ b1UruRN6rarrgNB1L8JYiWpX00a45l9RhDwZjVqztvrHLTH8g3XFz7shg78H Lscpari7Vseh0MMCBcuy9vOAHYPEBB -----------end_max5_patcher-----------
This is almost certainly^W^W the result of one calculating with 32-bit floating point and the others using 64-bit.
expr is using lumber() internally.
On second thought, I expect expr() is also using 64-bit floats internally. However, data passed through patch cords is truncated to 32-bits.
It may be that Max 6.1 in 64-bit mode will pass floats through patch cords with 64-bit precision. I haven’t yet worked enough with 64-bit mode to know for sure (getting there). You didn’t state whether you are using 6.1 in 32-bit or 64-bit mode.
In case you haven’t seen any of the many, many posts on this subject, 32-bit floating point is only accurate to about 6 significant decimal places. So everything after 1731.23 is just noise.
dito. the truncation alone makes that difference already.