Gentoo Archives: gentoo-user

From: hw <hw@×××××××××××××××××××××.de>
To: gentoo-user@l.g.o
Subject: [gentoo-user] 69.99 != 69.99
Date: Sat, 22 Aug 2015 13:27:07
Message-Id: 55D878A0.8060302@gartencenter-vaehning.de
1 Hi,
2
3 I have the following in a perl script:
4
5
6 if ($a != $b) {
7 print "e: '$a', t: '$b'\n";
8 }
9
10
11 That will print:
12
13 e: '69.99', t: '69.99'
14
15
16 When I replace != with ne (if ($a ne $a) {), it doesn't print.
17
18
19 Is that a bug or a feature? And if it's a feature, what's the explanation?
20
21 And how do you deal with comparisions of variables when you get randomly
22 either correct results or wrong ones? It's randomly because this
23 statement checks multiple values in the script, and 69.99 is the only
24 number showing up yet which isn't numerically equal to itself (but equal
25 to itself when compared as strings).

Replies

Subject Author
Re: [gentoo-user] 69.99 != 69.99 R0b0t1 <r030t1@×××××.com>
Re: [gentoo-user] 69.99 != 69.99 Alan McKinnon <alan.mckinnon@×××××.com>
Re: [gentoo-user] 69.99 != 69.99 Alexander Kapshuk <alexander.kapshuk@×××××.com>
Re: [gentoo-user] 69.99 != 69.99 Fernando Rodriguez <frodriguez.developer@×××××××.com>