Re: It's a bug? Re: Strange problem

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

--=====================_1550049==_.ALT


At 09:38 AM 03/19/2000 -0500, you wrote:
>On Sun, 19 Mar 2000, Joel Crook wrote:
>>
>> I'd say Lewis  found a bug in the Euphoria code.
>>
>Yes, it is a bug, but not in the floor() function.
>When you create a constant, or pass a value:
>for example, Get(4.1), it actually passes a number
>"close" to 4.1. See the test code below, which
>produces these results:
>
>att: 4.09999999999999964473
>b: (att-floor(att) * 10) 0.99999999999999644729
>a: (floor(b)) 0.00000000000000000000
>att: 5.09999999999999964473
>b: (att-floor(att) * 10) 0.99999999999999644729
>a: (floor(b)) 0.00000000000000000000

That explains why, as I was puttering with the code last night,
if I made "att" slightly larger--  say 4.11 that the conversion worked...


>Therefore, floor() is doing what it is supposed to do,
>round off to a whole number less than or equal to the
>value passed. The problem is in how to pass exactly the
>value you want to pass.
<SNIP!>
>Regards,
>Irv

Thanks Irv for the lesson on  floats in Euphoria.

 I'll have to try this in TP7 and see what it does..

Thanks again,

Joel

Joel H. Crook

"When the code works perfectly, the program is obsolete."
  -- "The Gosple According to St. Murphy"
--=====================_1550049==_.ALT

<html><div>At 09:38 AM 03/19/2000 -0500, you wrote:</div>
<div>&gt;On Sun, 19 Mar 2000, Joel Crook wrote:</div>
<div>&gt;&gt;</div>
<div>&gt;&gt; I'd say Lewis&nbsp; found a bug in the Euphoria
code.</div>
<div>&gt;&gt;</div>
<div>&gt;Yes, it is a bug, but not in the floor() function.</div>
<div>&gt;When you create a constant, or pass a value:</div>
<div>&gt;for example, Get(4.1), it actually passes a number</div>
<div>&gt;&quot;close&quot; to 4.1. See the test code below, which</div>
<div>&gt;produces these results:</div>
<div>&gt;</div>
<div>&gt;att: 4.09999999999999964473</div>
<div>&gt;b: (att-floor(att) * 10) 0.99999999999999644729</div>
<div>&gt;a: (floor(b)) 0.00000000000000000000</div>
<div>&gt;att: 5.09999999999999964473</div>
<div>&gt;b: (att-floor(att) * 10) 0.99999999999999644729</div>
<div>&gt;a: (floor(b)) 0.00000000000000000000</div>
<br>
<div>That explains why, as I was puttering with the code last night,
</div>
<div>if I made &quot;att&quot; slightly larger--&nbsp; say 4.11 that the
conversion worked...</div>
<br>
<br>
<div>&gt;Therefore, floor() is doing what it is supposed to do,</div>
<div>&gt;round off to a whole number less than or equal to the</div>
<div>&gt;value passed. The problem is in how to pass exactly the</div>
<div>&gt;value you want to pass.</div>
<div>&lt;SNIP!&gt;</div>
<div>&gt;Regards,</div>
<div>&gt;Irv</div>
<br>
<div>Thanks Irv for the lesson on&nbsp; floats in Euphoria.</div>
<br>
<div>&nbsp;I'll have to try this in TP7 and see what it does..</div>
<br>
<div>Thanks again,</div>
<br>
<div>Joel</div>
<br>

Joel H. Crook<br>
<br>
&quot;<b><i>When the code works perfectly, the program is
obsolete</b></i>.&quot;<br>
<div align="right">
&nbsp; -- &quot;The Gosple According to St. Murphy&quot;</html>

--=====================_1550049==_.ALT--

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

Search



Quick Links

User menu

Not signed in.

Misc Menu