6 Replies - 1866 Views - Last Post: 21 June 2012 - 07:30 AM Rate Topic: -----

#1 Bort  Icon User is offline

  • Ill-informed Mongoloid
  • member icon

Reputation: 396
  • Posts: 2,923
  • Joined: 18-September 06

Code Funnies

Posted 21 June 2012 - 06:51 AM

I spotted this ina piece of code I am trying to decipher, and it made me giggle...

Public Const INFINITE As UInt32


Infinity in an unsigned 32-bit Integer.
Is This A Good Question/Topic? 0
  • +

Replies To: Code Funnies

#2 Ryano121  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1362
  • View blog
  • Posts: 3,002
  • Joined: 30-January 11

Re: Code Funnies

Posted 21 June 2012 - 07:09 AM

What value does it take on?
Was This Post Helpful? 0
  • +
  • -

#3 Bort  Icon User is offline

  • Ill-informed Mongoloid
  • member icon

Reputation: 396
  • Posts: 2,923
  • Joined: 18-September 06

Re: Code Funnies

Posted 21 June 2012 - 07:10 AM

This one:

&HFFFFFFFFUI
Was This Post Helpful? 0
  • +
  • -

#4 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7578
  • View blog
  • Posts: 12,742
  • Joined: 19-March 11

Re: Code Funnies

Posted 21 June 2012 - 07:14 AM

Negative 1 != infinity


(XFFFFFFFF represents a "quiet NAN" in IEEE floating-point representation, but this is an int, presumably twos-complement, so XFFFF FFFF would represent -1)
Was This Post Helpful? 0
  • +
  • -

#5 Ryano121  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1362
  • View blog
  • Posts: 3,002
  • Joined: 30-January 11

Re: Code Funnies

Posted 21 June 2012 - 07:15 AM

Interesting variable naming decision.

This post has been edited by Ryano121: 21 June 2012 - 07:16 AM

Was This Post Helpful? 0
  • +
  • -

#6 Bort  Icon User is offline

  • Ill-informed Mongoloid
  • member icon

Reputation: 396
  • Posts: 2,923
  • Joined: 18-September 06

Re: Code Funnies

Posted 21 June 2012 - 07:18 AM

View Postjon.kiparsky, on 21 June 2012 - 08:14 AM, said:

Negative 1 != infinity


(XFFFFFFFF represents a "quiet NAN" in IEEE floating-point representation, but this is an int, presumably twos-complement, so XFFFF FFFF would represent -1)


So, Infinity is in fact -1?

Excellent. I think we've just solved one of the world's biggest questions there. How big can infinity get? Apparently, not very :)
Was This Post Helpful? 0
  • +
  • -

#7 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7578
  • View blog
  • Posts: 12,742
  • Joined: 19-March 11

Re: Code Funnies

Posted 21 June 2012 - 07:30 AM

INFINITY is negative 1. Which makes sense. If you start at zero and keep adding 1 forever, that's as far as you'll get... :)


BTW, my bad: I forgot that we're looking at an unsigned. So that's going to be just boring old 16^8-1, I guess.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1