# BreakPoint

cancel
Showing results for
Did you mean:

Highlighted

## 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 Do more with less code and in less time
Message 1 of 10
(1,608 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
Message 2 of 10
(1,603 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
(1,548 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

Message 4 of 10
(1,537 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
(1,529 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
(1,337 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
(1,313 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 Do more with less code and in less time
Message 8 of 10
(1,305 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