On Sat, Aug 22 2015, Mike Gilbert wrote:
> On Sat, Aug 22, 2015 at 1:32 PM, Alan McKinnon
> wrote:
>> I can tell you that equality comparisons on floats are problematic, and
>> always will be due to how they are stored (double-precision floats,
>> inhernetly inexact). This is not a "problem" per
On Sat, 22 Aug 2015 16:57:41 hw wrote:
> Am 22.08.2015 um 15:43 schrieb Alan McKinnon:
> > On 22/08/2015 15:26, hw wrote:
> >> Hi,
> >>
> >> I have the following in a perl script:
> >>if ($a != $b) {
> >>
> >> print "e: '$a', t: '$b'\n";
> >>
> >>}
> >>
>
On Sat, Aug 22, 2015 at 1:32 PM, Alan McKinnon wrote:
> I can tell you that equality comparisons on floats are problematic, and
> always will be due to how they are stored (double-precision floats,
> inhernetly inexact). This is not a "problem" per se, it's a systemic
> side effect of how our comp
On Saturday, August 22, 2015 3:26:56 PM hw wrote:
>
> Hi,
>
> I have the following in a perl script:
>
>
>if ($a != $b) {
> print "e: '$a', t: '$b'\n";
>}
>
>
> That will print:
>
> e: '69.99', t: '69.99'
>
>
> When I replace != with ne (if ($a ne $a) {), it doesn'
On 08/22/2015 01:27 PM, allan gottlieb wrote:
>>
>> Floating point addition isn't even commutative:
>>
>> > 0.1 + 0.2 + 0.3
>> 0.6001
>> > 0.1 + (0.2 + 0.3)
>> 0.6
>
> That demonstrates non-associativity. I believe floating point is
> commutative: a+b = b+a
>
Derp, thanks, y
On 22/08/2015 17:38, Alexander Kapshuk wrote:
> On Sat, Aug 22, 2015 at 4:26 PM, hw wrote:
>>
>> Hi,
>>
>> I have the following in a perl script:
>>
>>
>> if ($a != $b) {
>> print "e: '$a', t: '$b'\n";
>> }
>>
>>
>> That will print:
>>
>> e: '69.99', t: '69.99'
>>
>>
>> When I
On 22/08/2015 16:57, hw wrote:
>
>
> Am 22.08.2015 um 15:43 schrieb Alan McKinnon:
>> On 22/08/2015 15:26, hw wrote:
>>>
>>> Hi,
>>>
>>> I have the following in a perl script:
>>>
>>>
>>>if ($a != $b) {
>>> print "e: '$a', t: '$b'\n";
>>>}
>>>
>>>
>>> That will print:
>>>
On Sat, Aug 22 2015, Michael Orlitzky wrote:
> On 08/22/2015 09:42 AM, R0b0t1 wrote:
>> https://en.wikipedia.org/wiki/Round-off_error
>> https://en.wikipedia.org/wiki/Machine_epsilon
>>
>> Either add a tolerance (a - b <= t) or compare them as strings as
>> you've been doing.
>>
>
> You probably
On 08/22/2015 09:42 AM, R0b0t1 wrote:
> https://en.wikipedia.org/wiki/Round-off_error
> https://en.wikipedia.org/wiki/Machine_epsilon
>
> Either add a tolerance (a - b <= t) or compare them as strings as
> you've been doing.
>
You probably want |a - b| <= t there =)
But... that can cause proble
On Sat, Aug 22, 2015 at 4:26 PM, hw wrote:
>
> Hi,
>
> I have the following in a perl script:
>
>
> if ($a != $b) {
> print "e: '$a', t: '$b'\n";
> }
>
>
> That will print:
>
> e: '69.99', t: '69.99'
>
>
> When I replace != with ne (if ($a ne $a) {), it doesn't print.
>
>
> Is
On Sat, 22 Aug 2015 16:57:41 +0200, hw wrote:
>
>
> Am 22.08.2015 um 15:43 schrieb Alan McKinnon:
> > On 22/08/2015 15:26, hw wrote:
> >>
> >> Hi,
> >>
> >> I have the following in a perl script:
> >>
> >>
> >>if ($a != $b) {
> >> print "e: '$a', t: '$b'\n";
> >>}
> >>
>
Am 22.08.2015 um 15:43 schrieb Alan McKinnon:
On 22/08/2015 15:26, hw wrote:
Hi,
I have the following in a perl script:
if ($a != $b) {
print "e: '$a', t: '$b'\n";
}
That will print:
e: '69.99', t: '69.99'
When I replace != with ne (if ($a ne $a) {), it doesn't
On 22/08/2015 15:26, hw wrote:
>
> Hi,
>
> I have the following in a perl script:
>
>
> if ($a != $b) {
> print "e: '$a', t: '$b'\n";
> }
>
>
> That will print:
>
> e: '69.99', t: '69.99'
>
>
> When I replace != with ne (if ($a ne $a) {), it doesn't print.
>
>
> Is th
https://en.wikipedia.org/wiki/Round-off_error
https://en.wikipedia.org/wiki/Machine_epsilon
Either add a tolerance (a - b <= t) or compare them as strings as
you've been doing.
Hi,
I have the following in a perl script:
if ($a != $b) {
print "e: '$a', t: '$b'\n";
}
That will print:
e: '69.99', t: '69.99'
When I replace != with ne (if ($a ne $a) {), it doesn't print.
Is that a bug or a feature? And if it's a feature, what's the explanation?
15 matches
Mail list logo