'int' object gives different results when receiving -inf between Mac OSX and Windows (maxm

    Mar 14 2006 | 10:07 am
    I found a different behaviour between OSX and Win for int object. When it receives float -infinity : * on OSX, returns minimal integer : -2147483648 * on Win, returns zero
    The behaviour on windows is buggy, float -infinity cannot be int zero.
    -inf is obtained by sending zero to atodb. (So my custom vumeters, which are working fine on OSX are broken on windows)
    the problem is the same for int box number.
    Best regards, Chris
    NB: see below simple patch to test this

    • Mar 14 2006 | 11:35 am
      The obvious suspect is differences in the implementation of IEEE 754 at either the level of mathlib.c, the OS, or the processor. So it's not as if it's directly Max' "fault".
      Still, Max' developers seem to take pride in its cross-platform compatibility, and it would be a Good Thing if the idiosyncrasies of Mac vs. Windows implementations of IEEE 754 could be overcome.
      I don't know off-hand what IEEE 754 specifies when typecasting float infinities to integer. I think min/max int values are the most logical (i.e., what happens on Mac OS).
      -- Peter
      -------------- http://www.bek.no/~pcastine/Litter/ ------------- Peter Castine | +--> Litter Power & Litter Bundle for Jitter |.................................................... p@castine.de | iCE: Sequencing, Recording, and Interface Building pcastine@gmx.net | for Max/MSP pcastine@bek.no | http://www.dspaudio.com/ Extremely cool 4-15@kagi.com |.................................................... | home|chez nous|wir|i nostri http://www.castine.de/
    • Mar 14 2006 | 2:19 pm
      i would not have known the details peter knows, but would have guessed the same: calculation in MAX uses mathlib, so it is a mathlib issue.
      maybe it is not even a windows mathlib error, we could call it a mac os bug as well, int isn t exactly a number isn t it? we should not exspect to display number box anything else than numbers, it will not display pi, and we can not exspect it to display inf. :)
      it is a great service already than numbox displays NaN where neccessary.
    • Mar 14 2006 | 9:11 pm
      number box is one part of the problem, but "int" object is another. it should pass a value to outlet indicating an approximation of -inf. for int, the best is -2147.....
      I guess the problem is the same with +inf.
    • Mar 14 2006 | 10:12 pm
      Thanks Chris,
      I think it should work the way it does on the Mac too.
    • Mar 15 2006 | 8:17 am
      > I think it should work the way it does on the Mac too. yes, this is the main point, to have cross plateform compatible patchs.
    • Mar 16 2006 | 4:41 pm
      OK, here's the deal.
      This issue is processor specific. The feeling among the developers is that if the c language doesn't take a stand on this then it may be for some good reason. The conversion should be treated as undefined and worked around with something like this