It's a bug? Re: Strange problem

new topic     » topic index » view thread      » older message » newer message

--=====================_481794395==_.ALT

At 11:50 PM 03/18/2000 -0500, you wrote:
>Everett Williams wrote:
>
>Sometimes I am a little slow, but I do finally get there. In a case where the
>system truncates rather than rounds, the normal solution is to add .5
>except in this case where we are not sure that the conversion is always
>less than the original decimal number. Given the answer to that question is
>yes, then adding .5 solves the problem. Only a lot of very exacting testing or
>an answer from RDS will solve the question for sure.
>
>Everett L.(Rett) Williams
>rett at gvtc.com


I modified his code a little bit and found something interesting:


include misc.e

global constant
  POSITION =      4,
    LEFT =          4.1,
    TOP =           4.2,
  DEMINSIONS =    5,
    WIDTH =         5.1,
    HEIGHT =        5.2,
    objects = {
                {1,0,{},{ 0, 0},{639,479}, 1,1,1},
                {1,0,{},{10,10},{459,459},-1,1,1}

              }

global function Get (integer obj, atom att)
atom b
integer a
b=att - floor (att)
b=b*10
a=floor(b)
? att
? b
? a
return objects [obj] [att]

end function

object view
view = 2


constant vp = {Get (view,WIDTH),Get (view, HEIGHT)}
? ({Get(view,LEFT), Get(view,TOP)})
--

-- the following numbers are returned:

5.1     -- this is att
1       -- this is b
0 <----- This is the result of a= floor(b) Notice ----This "should be" 1 ---  I
think this is a bug
5.2
2
2 <----- the second number is ok
4.1
1
0 <----- Notice ----again floor (b) fails
4.2
2
2<----- the fourth number is ok

I'd say Lewis  found a bug in the Euphoria code.


Joel H. Crook

Manager, Information Services
Certified Novell Administrator
Microsoft Certified Professional, OS Specialist

Kellogg & Andelson Accountancy Corp.
14724 Ventura Blvd. 2nd Floor
Sherman Oaks, CA 91403
(818) 971-5100

--=====================_481794395==_.ALT

<html>
At 11:50 PM 03/18/2000 -0500, you wrote:<br>
&gt;Everett Williams wrote:<br>
&gt;<br>
&gt;Sometimes I am a little slow, but I do finally get there. In a case
where the<br>
&gt;system truncates rather than rounds, the normal solution is to add
.5<br>
&gt;except in this case where we are not sure that the conversion is
always<br>
&gt;less than the original decimal number. Given the answer to that
question is<br>
&gt;yes, then adding .5 solves the problem. Only a lot of very exacting
testing or<br>
&gt;an answer from RDS will solve the question for sure.<br>
&gt;<br>
&gt;Everett L.(Rett) Williams<br>
&gt;rett at gvtc.com<br>
<br>
<br>
I modified his code a little bit and found something interesting:<br>
<br>
<br>
include misc.e<br>
<br>
global constant<br>
&nbsp; POSITION =&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4,<br>
&nbsp;&nbsp;&nbsp; LEFT
=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4.1,<br>
&nbsp;&nbsp;&nbsp; TOP
=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4.2,<br>
&nbsp; DEMINSIONS =&nbsp;&nbsp;&nbsp; 5,<br>
&nbsp;&nbsp;&nbsp; WIDTH
=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5.1,<br>
&nbsp;&nbsp;&nbsp; HEIGHT =&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
5.2,<br>
&nbsp;&nbsp;&nbsp; objects = {<br>
{1,0,{},{ 0, 0},{639,479}, 1,1,1},<br>
{1,0,{},{10,10},{459,459},-1,1,1}<br>
<br>
}<br>
<br>
global function Get (integer obj, atom att)
<dl>
<dd>atom b
<dd>integer a
<dd>b=att - floor (att)
<dd>b=b*10
<dd>a=floor(b)
<dd>? att
<dd>? b
<dd>? a
<dd>return objects [obj] [att]<br>
<br>

</dl>end function<br>
<br>
object view<br>
view = 2<br>
<br>
<br>
constant vp = {Get (view,WIDTH),Get (view, HEIGHT)}<br>
? ({Get(view,LEFT), Get(view,TOP)})<br>
--<br>
<br>
-- the following numbers are returned:<br>
<br>
5.1 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>-- this is att<br>
1<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>-- this is b
<br>
0 &lt;----- This is the result of a= floor(b) Notice ----This
&quot;should be&quot; 1 ---&nbsp; I think this is a bug<br>
5.2<br>
2<br>
2 &lt;----- the second number is ok<br>
4.1<br>
1<br>
0 &lt;----- Notice ----again floor (b) fails<br>
4.2<br>
2<br>
2&lt;----- the fourth number is ok<br>
<br>
I'd say Lewis&nbsp; found a bug in the Euphoria code.<br>
<br>
<br>

Joel H. Crook<br>
<br>
Manager, Information Services<br>
<font size=1>Certified Novell Administrator<br>
Microsoft Certified Professional, OS Specialist<br>
<br>
</font><b>Kellogg &amp; Andelson Accountancy Corp.<br>
</b><font size=1>14724 Ventura Blvd. 2nd Floor<br>
Sherman Oaks, CA 91403<br>
(818) 971-5100<br>
</font></html>

--=====================_481794395==_.ALT--

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu