Forums > MaxMSP

[table]-like object to store float number?

January 15, 2010 | 3:18 pm

Dear all,

I want to use [table] to store an array of float numbers, but find out that table will round then into integer. From the reference document it seems to be the correct behavior. So what object should I use to store float number without rounding? Thanks

January 15, 2010 | 3:35 pm

You can use coll.

Alternately, multiply your floats by a constant (10.0, 100.0, 1000.0, or whatever gives you sufficient accuracy), round *that* to integer and store in table, then divide by the same value when you retrieve the value from the table.

FTR: Floats are truncated when converted to integer, not rounded.

January 15, 2010 | 3:35 pm

If you own Jitter, then jit.matrix

Or multiply your values (by 100 for instance) before storing them in the table and divide by 100 when recalling them.

January 15, 2010 | 3:46 pm

I have Jitter, that solve the problem. Actually since all I want to store are rational numbers, I can just store pairs of integers. But I feel that it’s troublesome, so I try to find a shortcut. Many thanks for all your replies.

January 16, 2010 | 2:18 pm

[buffer~] may work as well.

Viewing 5 posts - 1 through 5 (of 5 total)

Forums > MaxMSP