Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSSlider maxValue not reached.



Hi,

I'm learning Cocoa and I found something strange with the NSSlider. I
wrote a very simple example with a slider and a label. The label shows
the value of the slider in real time (outlet / action / controller,
simple MVC with no bindings).

There is no problem with the horizontal and vertical sliders: both go
from 0 to 100 and the correct value is shown in the label. The
behaviour is still good with the floatValue of the sliders: from 0.0
to 100.0.

Something mysterious happens to the circular version of the slider
(whether it is regular or small): the maxValue (in my example 100) is
skipped and never reached. It either goes from 99 to 0 (if I ask for
the intValue of the slider) or from 99.99... to 0.0 (if I ask for the
floatValue).

Is this glitch caused by the floating point specifications (IEEE754?)
or the limitations of the precision in the CPU? But in this case, why
do the horizontal and vertical sliders show the correct value: 100 and
100.0?

Thanks.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.