Jump to content


Click the link below to see the new game I'm developing!


Photo
- - - - -

20 years of rubbish and still counting


21 replies to this topic

#1 Richard Bassett

Richard Bassett

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 707 posts
  • Gender:Not Telling
  • Location:Rural France

Posted 26 August 2005 - 05:04 PM

Well, my Friday's been spoiled by ProIV and not for the first time.
So I thought I'd share this "feature" with you..

#v1 = 0
#v2 = - #v1
IF #v1 = #v2 THEN UMSG("Yes, #v1 equals #v2", -1) ;
IF #v1 <> - #v1 THEN UMSG("No, #v1 does not equal -#v1", -1)


You have to try it to believe it..
Nothing's as simple as you think

#2 Joseph Bove

Joseph Bove

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 756 posts
  • Gender:Male
  • Location:Ramsey, United States

Posted 26 August 2005 - 05:39 PM

Richard,

I tried it. I was told that they are equal.

By any chance, are you doing this in a function where you have mapped an output parameter from a global function to 0?

If so, you can end up changing the value of 0....


Regards,

Joseph

#3 Richard Bassett

Richard Bassett

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 707 posts
  • Gender:Not Telling
  • Location:Rural France

Posted 27 August 2005 - 10:58 AM

Joseph,

No, that's the entire (test) function.

The point is not that #v1 = #v2, it does, as you would expect.
The point is that #v1 <> -#v1 is also true.. Which is WRONG, WRONG, WRONG..

I hit this on V4.6 on Linux but it's so fundamental I'd bet it's universal unless it's been subsequently fixed.

You did see the second message too? Or didn't you?!

On a historical note..

Edited by Richard Bassett, 27 August 2005 - 10:59 AM.

Nothing's as simple as you think

#4 Guest_Juan E. Q. Zorro_*

Guest_Juan E. Q. Zorro_*
  • Guests

Posted 27 August 2005 - 11:01 AM

Nadia, is that you? Has been a long time.
Folks, I like you to meed my little sister, Nadia N. E. Zorro.
She is pretty no?

#5 Rob Donovan

Rob Donovan

    rob@proivrc.com

  • Admin
  • 1,652 posts
  • Gender:Male
  • Location:Spain

Posted 27 August 2005 - 11:02 AM

Hi,

I only see the first UMSG....

Rob D.

#6 Bob Filipiak

Bob Filipiak

    Expert

  • Members
  • PipPipPipPip
  • 133 posts
  • Gender:Male

Posted 27 August 2005 - 02:01 PM

Guys,

FWIW, I have always been under the assumption (and I do know how spell ass u me) that zero is an UNSIGNED value, i.e. neither positive nor negative.

But then again, I can be wrong.

Bob Filipiak

#7 Richard Bassett

Richard Bassett

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 707 posts
  • Gender:Not Telling
  • Location:Rural France

Posted 27 August 2005 - 03:50 PM

Hi,  I only see the first UMSG....

VERRY interesting Rob..
I know you'd have been careful but would you mind just sanity checking that you did the code exactly as shown.
And maybe just try the following more obvious one-liner that I should have posted to start with..

IF 0 = -0 THEN UMSG("Equal",-1) ELSE UMSG("Not equal",-1) ;

I see "not equal". Let me know your mileage and what platform you're on.

zero is .. neither positive nor negative .. but then again, I can be wrong.

Not in this universe you can't Bob.
Nothing's as simple as you think

#8 Rob Donovan

Rob Donovan

    rob@proivrc.com

  • Admin
  • 1,652 posts
  • Gender:Male
  • Location:Spain

Posted 27 August 2005 - 05:09 PM

I Cut & Pasted it from your post, into ProIV.

I get the 'Equal' UMSG from the 2nd example.

I'm using Windows XP (SP2) and ProIV 5.5r333

Rob D.

#9 Bob Filipiak

Bob Filipiak

    Expert

  • Members
  • PipPipPipPip
  • 133 posts
  • Gender:Male

Posted 27 August 2005 - 06:44 PM

Gents,

Maybe it is due to some defective math processors??

The computer is the only entity that thinks 2 + 2 = 5

Then, perhaps we're stuck in the



TWILIGHT ZONE


What do I know??

Bob Filipiak

PS> I spent the last 3 hours trying to find a silly syntax error. Doesn't pay to work when you are tired. I need a vacation

#10 Richard Bassett

Richard Bassett

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 707 posts
  • Gender:Not Telling
  • Location:Rural France

Posted 28 August 2005 - 10:30 AM

Rob,

Thanks for that. I'll try it on a a couple of other systems and see what I get.
Hopefully your result indicates that it's been fixed during the last 5 years :D

Bob,

There are certainly defective math processors but FWIW that is unlikely to be relevant to ProIV because ProIV's "numeric" data type is a decimal representation implemented in software. ProIV doesn't have the integer or binary-floating-point data types that are typically implemented by hardware.

I was definitely in the Twilight Zone Friday afternoon though.
Nothing's as simple as you think

#11 Mike Schoen

Mike Schoen

    Expert

  • Members
  • PipPipPipPip
  • 198 posts
  • Gender:Male
  • Location:Guelph, Canada

Posted 29 August 2005 - 01:11 PM

This appears to be a 4.6 feature.
I tried the same code under 4.6 and 5.5, and 5.5 got it right.

#12 Guest_Guest - Rick_*

Guest_Guest - Rick_*
  • Guests

Posted 29 August 2005 - 01:15 PM

#V1 = 0
#V2 = - #V1
IF #V1 = #V2 THEN UMSG('EQUAL',-1);
IF #V1 <> #V2 THEN UMSG('NOT EQUAL',-1);
IF 0 = -0 THEN UMSG('2ND EQUAL',-1) ELSE UMSG('2ND NOT EQUAL',-1);

EQUAL and 2ND EQUAL are my two UMSG's.

5.5rel411


-Rick

#13 Richard Bassett

Richard Bassett

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 707 posts
  • Gender:Not Telling
  • Location:Rural France

Posted 29 August 2005 - 02:36 PM

Thanks for all the cross-checks folks - and apologies for not checking it on a 5.5 system on Friday (dial-up access issue).
I was in a bad frame of mind Friday PM though and I admit I wasn't really expecting V5.5 would make any difference :-"
Nothing's as simple as you think

#14 Rob Donovan

Rob Donovan

    rob@proivrc.com

  • Admin
  • 1,652 posts
  • Gender:Male
  • Location:Spain

Posted 29 August 2005 - 03:11 PM

:D .... so it was a bug....

They still havent fixed the other one though :D

#15 Donald Miller

Donald Miller

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 205 posts
  • Gender:Male
  • Location:Cupar, Fife, Scotland
  • Interests:Motorcycling, Running, Cooking

Posted 29 August 2005 - 06:30 PM

Shouldn't that be

#v2 = -1 * #v1

Or does Pro IV see that as exactly the same as

#v2 = -#v1
Half of what he said meant something else, and the other half didn't mean anytthing at all



Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users

Click the link below to see the new game I'm developing!