## rounding fun times

Mar 17, 2013 at 4:18pm

# rounding fun times

Looks like we have another “feature”. Any decimal is automatically rounded to 6 places. Messages, floats, ANYTHING.

#67147
Mar 17, 2013 at 5:24pm

example?

#241624
Mar 17, 2013 at 5:27pm

Just try and type a decimal longer than 6 places in a messagebox, see what happens

#241625
Mar 18, 2013 at 1:14pm

and then try to do [* 1000.] – you should get your decimals right back ;) (at least up to your 32-bits, iirc.)

#241626
Mar 18, 2013 at 2:36pm

Havent gone through Gregory’s entire explanation, but if What Wetterberg says is true that’s actually pretty terrible. It means that if I look at a number I have no way whatsoever of knowing what its actual precision is. Since much of what I do depends on accurate division this is… a problem.

#241628
Mar 18, 2013 at 3:43pm

Yeah I was about to say, isn’t this just a problem with computers in general.

So one can either say “Well that’s unacceptable!”, and go on to create their own computer system without these limitations, or one can say “Isn’t it amazing that we can even do this much with computers?”, and proceed to find solutions that work around the limitations inherent to all computer systems.

My guess is one would find the second option a tad more manageable.

#241630
Mar 18, 2013 at 3:44pm

Um, no. I know all about floats and macheps and all that fun stuff(not the same but related, I know). My problem is that, if what wettenberg says is true, I cannot look at a message (and god knows what else) to see the precision of the float in question. I could care less about max rounding stuff to the nearest whatever, as long as it is consistent, transparent, and well-documented.

#241631
Mar 18, 2013 at 4:38pm

Hi,

Floating point representation is not a “problem” only in MaxMSP ;
It is well explained for Pyhon here : ( http://docs.python.org/3.3/tutorial/floatingpoint.html ).

On most machines, if Python were to print the true decimal value of the binary approximation stored for 0.1, it would have to display

0.1000000000000000055511151231257827021181583404541015625

Would it be better ?

#241632
Mar 18, 2013 at 4:43pm

Yes, but, you see, that is in official docs, which is exactly my point. Whereas I had to make a whiny forum post to learn about this situation in max. Hay poquita problema aqui.

#241633
Mar 18, 2013 at 4:52pm

Hi,

I don’t know how the documentation is in max 6 ; but given the numbers of question about floating point issue in the forum, you’re probably right ; IMHO the Python documentation is simple and clear and should be a model.

#241634
Mar 18, 2013 at 4:58pm

If the fora did not exist we would have to invent them =P

#241635
Mar 18, 2013 at 4:59pm

For a little more under-the-hood view of Max messages, the “printit” object from CNMAT will show you more detail about what data are being passed around. It’s here: http://cnmat.berkeley.edu/downloads

One goal of the Max environment is to shield users from the underlying implementation details, such as data types. Theoretically, artists can focus more on the art-making and not ever have to consider things like “24-bit manitssa.” As you’ve seen, this effort isn’t entirely successful. The needs of efficiency and 20+ years of legacy have left some rough edges. I doubt anybody writing Max from scratch today would recreate the set of compromises that are present in the current environment. Luckily, there is plenty of access to scripting languages in Max — C, java, lisp, lua, clojure, etc — for those times when you really need the control you’re looking for.

In the words of Charlie Papazian: “Relax. Don’t Worry. Have a home-brew.”

#241636
Mar 18, 2013 at 5:02pm

Shield and poorly document do not have to be synonymous

#241637
Mar 19, 2013 at 12:15am

…it’s actually worse than you think. Type “0.0001234″ into a message box.
looks like: “0.000123″
connect to [* 1000.].
result: 0.1234
save that patch, and re-open.
result 0.123

I agree that this isn’t ok.

#241638
Mar 19, 2013 at 3:55am

ugh

#241639
Mar 19, 2013 at 10:39pm

Jamesson is working under a fundamental misunderstanding of how numbers work in Max (and, more generally, in all computer software).

Max is not “rounding” anything to some number of decimal places. Max is (necessarily) converting your decimal representation into the binary representation used in essentially *a*l*l* computer software. The display used in flonums, message boxes, [capture], etc., is then a reconversion back into a decimal representation with some number of decimal points.

It probably doesn’t help matters that each of these objects uses a different number of decimal places. But that’s irrelevant.

@Jamesson: you need to RUN, not walk, to Peter Elsea’s tutorial on floating point arithmetic in Max. Do not pass go, do not collect \$200, and most certainly do not post until you have read and understood this document:

#241640
Mar 20, 2013 at 2:49am

“It means that if I look at a number I have no way whatsoever of knowing what its actual precision is. Since much of what I do depends on accurate division this is… a problem.”

you _do_ always know the precision. it is just not bound to decimal places. ;)

#241641
Sep 28, 2013 at 4:41am

@ Peter castine “… do not post until you have read and understood this document“.

The link is not working.

B

#266504
Sep 28, 2013 at 11:56am

Thank you !

B

#266524

You must be logged in to reply to this topic.