# BreakPoint

cancel
Showing results for
Did you mean:

## Programming Trivia Pop Quiz: Be Different!

Unlike the last question, this one should be common knowledge for everybody.

QUESTION: Find a value that will cause the boolean to be TRUE when the code is executed.

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 1 of 10
(8,185 Views)

## Re: Programming Trivia Pop Quiz: Be Different!

This one is too easy

Spoiler
There is not a number that will return TRUE here.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 10
(8,180 Views)

## Re: Programming Trivia Pop Quiz: Be Different!

Spoiler
might this be a trick question?
i know that you cannot guarantee x + (y+z) == (x+y)+z for floating points,
but to compare the same number/bit-representation against each other should never be different.

If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
Message 3 of 10
(8,125 Views)

## Re: Programming Trivia Pop Quiz: Be Different!

@jwscs wrote:

Spoiler

Spoiler
Spoiler
might this be a trick question?
i know that you cannot guarantee x + (y+z) == (x+y)+z for floating points,
but to compare the same number/bit-representation against each other should never be different.

If you look at the definition of floating point numbers, there is a case where it SHOULD be different.

That condition is what Christian is trying to teach us about with this trivia question.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 10
(8,114 Views)

## Re: Programming Trivia Pop Quiz: Be Different!

ok found it...

Spoiler
thought about NaN .. but searched for a constant, didn't enter my mind before to just write it in 😉

guess from mathematical standpoint it makes sense, since the value is undefined
https://stackoverflow.com/questions/1565164/what-is-the-rationale-for-all-comparisons-returning-fals...

If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
Message 5 of 10
(8,106 Views)

## Re: Programming Trivia Pop Quiz: Be Different!

My first guess was either +inf or -inf.  Interestingly enough, this returns false.  I guess you could prove that a double precision float is countably infinite...

Message 6 of 10
(7,914 Views)

## Re: Programming Trivia Pop Quiz: Be Different!

@BownM i must disagree with you, since you only have a finite number of bytes for the representation, it follows, that there can only be a finite number of different numbers.

If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
Message 7 of 10
(7,890 Views)

## Re: Programming Trivia Pop Quiz: Be Different!

According to IEEE-754, there is exactly one unique bit pattern for +inf and -inf, respectively. However, there is a huge number of different NaNs. (details)

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 8 of 10
(7,882 Views)

## Re: Programming Trivia Pop Quiz: Be Different!

@jwscs wrote:

@BownM i must disagree with you, since you only have a finite number of bytes for the representation, it follows, that there can only be a finite number of different numbers.

Approximately 18.4*10^18 unique combinations. 🙂

/Y