It is currently Fri Sep 25, 2026 4:14 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 91 posts ]  Go to page Previous  1, 2, 3, 4, 5
Author Message
 Post subject: Re: Need Assistance Testing Another Simple Script
PostPosted: Mon Apr 20, 2015 5:56 am  (#81) 
Offline
Script Coder
User avatar

Joined: Dec 27, 2014
Posts: 508
Sorry, Kevin, nice theory but it doesn't work like that. I've been right thru the GTK spinbutton code and all the range-limiting, stepping, etc is done with double-floats and no rounding in sight.

I think the reason you're getting different results with step-interval 0.2 and different again with 0.200001 is simply a matter of the way the floating-point errors accumulate.
0.1 in binary is the infinitely-repeating sequence 0.00011001100...
So, in IEEE-754 binary64 which uses a 53-bit fractional part, the nearest approximation is:
0.00011001100110011001100110011001100110011001100110011
And 0.2 is the same pattern shifted left one place:
0.00110011001100110011001100110011001100110011001100110
These will accumulate tiny errors from the least-significant end in rather different patterns.
But the value 0.200001 is a completely different bit pattern (unrelated to either the above) and so will accumulate errors in a different way again.

@Dinasset
I think that's just the GTK spinbutton widget being updated "interactively" - the script itself will not be executed until and unless you hit the OK button.


Top
 Post subject: Re: Need Assistance Testing Another Simple Script
PostPosted: Mon Apr 20, 2015 6:11 am  (#82) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14835
Location: roma, italy
Thanks Jonathan!
thus, if the "hold-on" is executed appropriately, GTK updates only one time, from initial 1.0 to final 0.0 and the result looks OK

_________________
"Where am I ?"


Top
 Post subject: Re: Need Assistance Testing Another Simple Script
PostPosted: Mon Apr 20, 2015 6:14 am  (#83) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14835
Location: roma, italy
...and it would be possible to have a GTK spinbutton which "waits"? thus reacting only to when the script enters again thru the OK of the user?
maybe a silly question again....

_________________
"Where am I ?"


Top
 Post subject: Re: Need Assistance Testing Another Simple Script
PostPosted: Mon Apr 20, 2015 6:30 am  (#84) 
Offline
Script Coder
User avatar

Joined: Dec 27, 2014
Posts: 508
dinasset wrote:
Thanks Jonathan!
thus, if the "hold-on" is executed appropriately, GTK updates only one time, from initial 1.0 to final 0.0 and the result looks OK

No, when you first press an up/down button, GTK increments or decrements the value immediately but also starts a timer for 0.5 second. If the button is still pressed at the end of that 0.5 second, GTK will then start auto-incrementing/decrementing the value every 0.05 second until you release the button.
Every time the value is updated, it is passed to the Script-Fu Extension plugin, which stores the new value in a local data structure for the script in question..

Quote:
..and it would be possible to have a GTK spinbutton which "waits"? thus reacting only to when the script enters again thru the OK of the user?

Sorry Diego, I don't know what you mean by this. The script itself does not do anything until and unless you press "OK" on the dialog. In doesn't have any opportunity to do anything. The entire dialog is executed by the Script-Fu Extension plugin on behalf of the script, using the information in the registration block (ie. the SF_xxx parameters)


Top
 Post subject: Re: Need Assistance Testing Another Simple Script
PostPosted: Mon Apr 20, 2015 6:37 am  (#85) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
GnuTux wrote:
You make some interesting points, Saul. Perhaps the precision is for display purposes only.

Nevertheless, my bottom line is that when I set the min value to be zero and use the spinner/slider or whatever to move to zero, and the result is not zero, I'd call that a bug. In that case, I don't think the return value should be anything other than zero, no matter whether it's an integer or float. Surely, you would agree that's a bug. :cool

I will agree that it is a bug that the returned value is not "0" when the display is "0" AND the spin down button is grayed out. That is to say, when the value is 1e-16 or somesuch, it may not be a bug that "0" is displayed yet one should still be allowed to spin it down to "0" -- this regardless of whatever step size is chosen or precision used for display.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Need Assistance Testing Another Simple Script
PostPosted: Mon Apr 20, 2015 7:12 am  (#86) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14835
Location: roma, italy
jontait2 wrote:
dinasset wrote:
Thanks Jonathan!
thus, if the "hold-on" is executed appropriately, GTK updates only one time, from initial 1.0 to final 0.0 and the result looks OK

No, when you first press an up/down button, GTK increments or decrements the value immediately but also starts a timer for 0.5 second. If the button is still pressed at the end of that 0.5 second, GTK will then start auto-incrementing/decrementing the value every 0.05 second until you release the button.
Every time the value is updated, it is passed to the Script-Fu Extension plugin, which stores the new value in a local data structure for the script in question..

my turn not to understand, and I do not mean that I don't understand what you say, but I don't understand why -by the "hold-on" technique- the resulting value is shown precise 0 if starting from an initial value >= 0.9, because, following your explanation:
- as soon as I press the down button GTK decrements the value immediately (? thus to 0.9 or 1.0 or...whatever initial value ?)
- then (because the hold-on certainly stays for more than 0.5 seconds) the value is updated again (when input is 0.0) and the displayed value is precise 0 (OK)
But the same should occur if I use this technique starting from any value, also below 0.9, if I hold the down botton for more than 0.5 seconds, the parameter shows at the end 0.0, the new update takes this 0.0 but the msg displays that "strange" value; why?

_________________
"Where am I ?"


Top
 Post subject: Re: Need Assistance Testing Another Simple Script
PostPosted: Mon Apr 20, 2015 7:14 am  (#87) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
I think I've found the spin-button limitation is 1e-10:
   SF-ADJUSTMENT  _"Zero Spinner"   '(1e-10 0 40 1e-10 1 12 0)

This displays the dialog with the spin down button disabled, and because the increment is also 1e-10 it never gets enabled by single presses of the up button.

Kevin


Top
 Post subject: Re: Need Assistance Testing Another Simple Script
PostPosted: Mon Apr 20, 2015 7:58 am  (#88) 
Offline
Script Coder
User avatar

Joined: Dec 27, 2014
Posts: 508
paynekj wrote:
I think I've found the spin-button limitation is 1e-10:
Yes, I've come across this before. This document says that you can configure the spinbutton to display up to 20 decimal places: http://www.pygtk.org/pygtk2reference/cl ... set-digits

But thats just the display ..internally the spinbox only works to 10 decimal digits accuracy.
in file gtkspinbutton.c:
#define EPSILON               1e-10


Top
 Post subject: Re: Need Assistance Testing Another Simple Script
PostPosted: Mon Apr 20, 2015 11:42 am  (#89) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5241
Location: Gimpville
paynekj wrote:
I think I've found the spin-button limitation is 1e-10:
   SF-ADJUSTMENT  _"Zero Spinner"   '(1e-10 0 40 1e-10 1 12 0)

I noticed this last night, as well. Anything above 10 digits, the spinner becomes a dunsil (a part without a useful purpose). I suppose once the precision gets high enough, errors that creep in make the results pretty much useless anyway.

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


Top
 Post subject: Re: Need Assistance Testing Another Simple Script
PostPosted: Thu Apr 23, 2015 8:49 pm  (#90) 
Offline
Script Coder
User avatar

Joined: Dec 27, 2014
Posts: 508
GTK spinbutton fails to "snap" to limits reported as a bug:

https://bugzilla.gnome.org/show_bug.cgi?id=748392


Top
 Post subject: Re: Need Assistance Testing Another Simple Script
PostPosted: Thu Apr 23, 2015 9:29 pm  (#91) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
jontait2 wrote:
GTK spinbutton fails to "snap" to limits reported as a bug:

https://bugzilla.gnome.org/show_bug.cgi?id=748392

One of the best bug reports I've ever read. Very well written.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
Post new topic Reply to topic  [ 91 posts ]  Go to page Previous  1, 2, 3, 4, 5

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group