Page 2 of 2

Re: AngleGadget - circular trackbar + user-defined labels

Posted: Mon Jul 11, 2011 4:06 pm
by netmaestro
@skywalk: That has nothing to do with the float assignment. You're testing the (continually incrementing) count var against itself multiplied by 2. It should go on forever, if it didn't that would be a concern.

Re: AngleGadget - circular trackbar + user-defined labels

Posted: Mon Jul 11, 2011 4:14 pm
by luis
@netmaestro

OMG. I just checked the 4.20 (one of the first versions I used).

You are right, the decimal part was cut off at the time ! This can be a major cause of old sources going to hell.

It's not like a library command modified, it's the core of the language.

I don't feel very well ....


output of PB 4.20 for reference:

Code: Select all

l.i = 0.6 * 2
Debug l ; 1 (1.2 rounded down, apparently) - in reality cut off

l.i = 0.9 * 2
Debug l ; 1 (cut off)

l.i = 0.6
Debug l*2 ; 0 (make sense)
When all this changed ? And most importantly, can we count to have this behavior back again ?

Re: AngleGadget - circular trackbar + user-defined labels

Posted: Mon Jul 11, 2011 4:21 pm
by netmaestro
Fred should change it back, that's my opinion.

c:

Code: Select all

#include <stdio.h>

int main()
{
	float a = 0.99;
	int b = 0;
	b=a;
 	printf( "Float 0.9 assigned to int 0 = %d", b );  /* displays 0, the whole decimal portion is chopped */

	getchar();
}

Re: AngleGadget - circular trackbar + user-defined labels

Posted: Mon Jul 11, 2011 4:28 pm
by rsts
luis wrote: snip

When all this changed ? And most importantly, can we count to have this behavior back again ?
Are you asking that it be changed back?

If so, anyone counting on the more recent behavior would be in trouble.

cheers

Re: AngleGadget - circular trackbar + user-defined labels

Posted: Mon Jul 11, 2011 4:31 pm
by luis
rsts wrote: If so, anyone counting on the more recent behavior would be in trouble.
Exactly so.

And I reiterate that ALL this should be written down, it's really silly to have to experiment to see when a implicit cast is performed and how (round up, round down, cut off, etc.). Same thing for what's happening inside a mixed expression, and moreover on different architectures (x86/x64) if there are differences (and the code in this thread just shown there are plenty).

Re: AngleGadget - circular trackbar + user-defined labels

Posted: Mon Jul 11, 2011 4:37 pm
by netmaestro
I can find no mention of this in the history page. That is a concern as it seems completely undocumented.

Re: AngleGadget - circular trackbar + user-defined labels

Posted: Mon Jul 11, 2011 4:46 pm
by luis
What I mean is, instead of adding a new 3d command it's a lot more important to define and document the basic behavior of the language to help the initial understanding from new users and avoid further "drifting" like this in the future for old ones.

For example, I'm certainly dumb, and I didn't notice this was changed. I simply thought, "oh look, pb does it that way? I thought was the same way of C, well ok". Instead netmaestro remembered something different (thanks to him!).

If all this was clearly defined I would have checked the language definition like I would do for C, C++ or whatever.

OK a little experiment and hacking, Fred & Co are not an armada of software developers, with a branch dedicated to documentation and so on, they are great and I respect them, but some perspective on what it's really important is required.

At least that's my very personal opinion. Hope this can be taken as benign criticism.


EDIT in 2020: Wow, reading this today I find incredible how naive I was just 9 years ago.

Re: AngleGadget - circular trackbar + user-defined labels

Posted: Mon Jul 11, 2011 5:03 pm
by skywalk
netmaestro wrote:@skywalk: That has nothing to do with the float assignment. You're testing the (continually incrementing) count var against itself multiplied by 2. It should go on forever, if it didn't that would be a concern.
:oops: brain fart.

Re: AngleGadget - circular trackbar + user-defined labels

Posted: Fri Jul 15, 2011 11:08 am
by idle
despite the casting bugs , that's a one nice control thanks Stargate

Re: AngleGadget - circular trackbar + user-defined labels

Posted: Sun May 03, 2020 8:43 am
by SiggeSvahn
Is working fine if replacing the deprecated #PB_Canvas_GrabMouse with #PB_Canvas_Cursor. Thanks!

Re: AngleGadget - circular trackbar + user-defined labels

Posted: Sun May 10, 2020 6:54 pm
by Kwai chang caine
Apparently, i not see this code in 2011 :oops:
So a "little bit" thanks at Stargate for sharing it 8)