[table]-like object to store float number?
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
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.
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.
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.
[buffer~] may work as well.