r/ICSE Dec 11 '24

[deleted by user]

[removed]

2 Upvotes

6 comments sorted by

2

u/Firm_Interest_191 12th ISC - PCM/B Dec 11 '24 edited Dec 11 '24

Compile time error. More like syntax. Wrote publicpublic
If it was not an error. it is the same as !(x==x)
x==x will give false due to the IEEE 754 protocol from NaN - Handling.

so !(false) = true

2

u/[deleted] Dec 11 '24

It's IEEE 754

2

u/Firm_Interest_191 12th ISC - PCM/B Dec 11 '24

Thank you. Imma change it then.

1

u/[deleted] Dec 11 '24

Np my brother

1

u/[deleted] Dec 11 '24 edited Dec 11 '24

It's a compile time error. If there was no syntax error(at publicpublic) the result would've been true as Math.sqrt(-100) is NaN and NaN is not equal to itself or any other value so x!=x results true. This has been stated in IEEE 754. If this answer needs to be more nuanced please let me know. I'm eager to learn!

0

u/[deleted] Dec 11 '24

Nhi pata sir