Problem with MoveScale saved into .form files on gambas2

View: New views
4 Messages — Rating Filter:   Alert me  

Problem with MoveScale saved into .form files on gambas2

by acm-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

Some days ago a FreeBSD user report to me about a problem with gambas2
forms. The main problem was that forms were not displayed any controls
in there, but if we open a project from gambas2-examples it works
without problems. I tested with 2.15.2, 2.16 and 2.17 and It doesn't
work in those versions too.

I was investigating about that and I found that MoveScaled value into
.form files are saved like zero ( MoveScaled(0,0,0,0) ). It is not
working fine in FreeBSD. My question is what is the component of
gambas2 used for save MoveScaled value to .form files? and what files
could I see for fix the problem?

Greetings
ACM

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gambas-devel mailing list
Gambas-devel@...
https://lists.sourceforge.net/lists/listinfo/gambas-devel

Re: Problem with MoveScale saved into .form files on gambas2

by Bugzilla from gambas@users.sourceforge.net :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Hi
>
> Some days ago a FreeBSD user report to me about a problem with gambas2
> forms. The main problem was that forms were not displayed any controls
> in there, but if we open a project from gambas2-examples it works
> without problems. I tested with 2.15.2, 2.16 and 2.17 and It doesn't
> work in those versions too.
>
> I was investigating about that and I found that MoveScaled value into
> .form files are saved like zero ( MoveScaled(0,0,0,0) ). It is not
> working fine in FreeBSD. My question is what is the component of
> gambas2 used for save MoveScaled value to .form files? and what files
> could I see for fix the problem?
>
> Greetings
> ACM
>

I am almost sure that it is a bug in the Round() function on FreeBSD.

Can you confirm that by running: gbx2 -e "Round(100 / 7, -4)" ?

It must return 14.2857.

Regards,

--
Benoît Minisini

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gambas-devel mailing list
Gambas-devel@...
https://lists.sourceforge.net/lists/listinfo/gambas-devel

Re: Problem with MoveScale saved into .form files on gambas2

by acm-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/11/1 Benoît Minisini <gambas@...>:

>> Hi
>>
>> Some days ago a FreeBSD user report to me about a problem with gambas2
>> forms. The main problem was that forms were not displayed any controls
>> in there, but if we open a project from gambas2-examples it works
>> without problems. I tested with 2.15.2, 2.16 and 2.17 and It doesn't
>> work in those versions too.
>>
>> I was investigating about that and I found that MoveScaled value into
>> .form files are saved like zero ( MoveScaled(0,0,0,0) ). It is not
>> working fine in FreeBSD. My question is what is the component of
>> gambas2 used for save MoveScaled value to .form files? and what files
>> could I see for fix the problem?
>>
>> Greetings
>> ACM
>>
>
> I am almost sure that it is a bug in the Round() function on FreeBSD.
>
> Can you confirm that by running: gbx2 -e "Round(100 / 7, -4)" ?
>
> It must return 14.2857.
>
> Regards,
>
> --
> Benoît Minisini
>

It is 1,42857 here.

-3 -> 1,4286
-2 -> 1,429
-1 -> 1,43
0 -> 1,4

well, you are right it is a problem in the round function. where could
I see for try fix the problem?

Greetings
ACM

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gambas-devel mailing list
Gambas-devel@...
https://lists.sourceforge.net/lists/listinfo/gambas-devel

Parent Message unknown Re: Problem with MoveScale saved into .form files on gambas2

by Bugzilla from gambas@users.sourceforge.net :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> El día 10 de noviembre de 2009 20:02, Alonso Cárdenas Márquez
>
> <acardenas@...> escribió:
> > 2009/11/2 Benoît Minisini <gambas@...>:
> >> The Round() function is defined in the subr_math.c source file in the
> >> /main/gbx directory.
> >>
> >> Here is the code, with comments added:
> >>
> >> void SUBR_round(void)
> >> {
> >>  // 'val' is the value of the Round second argument, 0 by default.
> >>
> >>  int val = 0;
> >>  double power;
> >>
> >>  // Starts the subroutine. Actually just initializes a variable named
> >>  // 'NPARAM' with the number of arguments passed to the subroutine, and
> >> a // variable named 'PARAM', that points at the first argument on the //
> >> interpreter stack.
> >>
> >>  SUBR_ENTER();
> >>
> >>  // NPARAM is either 1 or 2 (this is checked by the compiler). If there
> >> is 2 // arguments, extract it from the stack and put it in the 'val'
> >> variable.
> >>
> >>  if (NPARAM == 2)
> >>    val = SUBR_get_integer(&PARAM[1]);
> >>
> >>  // Put 10^'val' inside the power variable. According to your test, the
> >> value // returned by Round() is 1/10th the true value. So the value of
> >> 'power' // should be checked with a debugger.
> >>
> >>  power = pow(10, val);
> >>
> >>  // Converts the first argument of Round() to a floating point value.
> >>
> >>  VALUE_conv(&PARAM[0], T_FLOAT);
> >>
> >>  // Defines the return value
> >>
> >>  RETURN->type = T_FLOAT;
> >>
> >>  // Do not use rint(), it does not do what I need.
> >>
> >>  /*RETURN->_float.value = rint(PARAM->_float.value / power) * power;*/
> >>
> >>  // The floor() function returns the largest integer value less than
> >>  // or equal to its argument. By adding 0.5 first, we are actually
> >> rounded // the value to the nearest integer.
> >>
> >>  // The following keeps the number of digits after the decimal point
> >> defined // by the 'val' variable.
> >>
> >>  RETURN->_float.value = floor(PARAM->_float.value / power + 0.5) *
> >> power;
> >>
> >>  // Exit the subroutine by removing the arguments from the interpreter
> >> stack.
> >>
> >>  SUBR_LEAVE();
> >> }
> >>
> >> If you are able to trace the subr_round() function with a debugger, and
> >> see what really happens, you are welcome!
> >>
> >> Regards,
> >>
> >> --
> >> Benoît Minisini
> >
> > Hi  :)
> >
> > I was doing some tests with Round function. I saw that current
> > subr_round() function is calculating the value correctly. The problem
> > is when you assign the value to
> >
> > RETURN->_float.value = floor(PARAM->_float.value / power + 0.5) * power;
> >
> > For example, If you print the same value assigned to a double variable
> >
> > double temp;
> >
> > temp = floor(PARAM->_float.value / power + 0.5) * power;
> >
> > printf("Value: %f", temp);
> >
> > This will show the right value.
> >
> > In another case, I assigned a value of 492,857 to RETURN->_float.value
> > on SUBR_round function (I assigned the value directly into
> > gbx_subr_math.c file). I compiled gbx2 and I called Round function
> > after and I saw that it is showing me the value of 4,92.
> >
> > Maybe it could give you an idea about where I could search for fix the
> > problem.
> >
> > Greetings
> > ACM
>
> Any news about that?
>
> Greetings
> ACM
>

Not really. But it seems something really weird : RETURN->_float.value is
already a "double", so how setting something in it can change the value?

What architecture do you use exactly?

--
Benoît Minisini

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-devel mailing list
Gambas-devel@...
https://lists.sourceforge.net/lists/listinfo/gambas-devel