Forums > Dev

Float Changes Value When Passed to Object's Struct

Apr 02 2009 | 1:46 pm

The xcode project for this object, including its C code and a test patch, can be found here:

I am having a very strange error for this object where incoming float values are received, but are not being properly assigned to variables within my object’s struct. If you open max with the mxo file for this object, then open the test patch, and send different float values to the inlets. I post in the max window the incoming value, the inlet that receives it, and then the value of the variable in my object’s struct after it gets set equal to the incoming float value. As you will see, the inlet number and the incoming float value get printed fine, but when my variable gets set equal to this incoming value, the variable in my object’s struct is some bizarre, irrelevant number. I am not doing anything fancy here, simply saying x->variable = incoming_float. And, yes, my types are all correct. The incoming value is a double, my object’s variables are t_floats. This shouldn’t be a problem and in the past I have set t_float variables equal to doubles before.Pleas help!


Apr 02 2009 | 8:10 pm

this is embarassing…..

my mistake was that i was posting float values with %d, so the incoming values actually were correct, just being displayed incorrectly….apologies for cluttering the forum.

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

Forums > Dev