hello
please excuse my stupid question, i'm only beginning to learn objc and cocoa...
i ran recently into a strange problem. trying to solve it, i eventually ended up writing a tiny app with two text fields: in and out, and a button. when i enter some value in the in field and press the button, it's supposed to copy the value into the out field. it works ok with integers but with floats the values are not the same!
0,1 -> 0,1000000014901161
1,2 -> 1,200000047683716
2,3 -> 2,299999952316284
the code is as simple as:
just this single line, not counting the automatically generated parts.
just in case i attach the xcode project.
could you please explain me what i'm doing wrong?
please excuse my stupid question, i'm only beginning to learn objc and cocoa...
i ran recently into a strange problem. trying to solve it, i eventually ended up writing a tiny app with two text fields: in and out, and a button. when i enter some value in the in field and press the button, it's supposed to copy the value into the out field. it works ok with integers but with floats the values are not the same!
0,1 -> 0,1000000014901161
1,2 -> 1,200000047683716
2,3 -> 2,299999952316284
the code is as simple as:
Code:
[outField setFloatValue:[inField floatValue]];
just in case i attach the xcode project.
could you please explain me what i'm doing wrong?