News for hackers. Stuff that matters.
Re:Return True to Win by dou4cc on Friday August 12, 2016 @07:59AM (#12274865)
The game shows us how ugly JS is.
Re:Return True to Win by posterboy on Friday August 12, 2016 @10:21AM (#12275843)
Indeed, I refuse to believe there should be a solution to the 'reflexive' task.
Re:Return True to Win by XaspR8d on Friday August 12, 2016 @11:26AM (#12276423)
So you disagree with the IEEE floating point specification, then? Javascript is directly following spec there.
Re:Return True to Win by effie on Friday August 12, 2016 @05:39PM (#12278992)
Do you think that such rule for NaN state is useful?
Re:Return True to Win by astrobe_ on Friday August 12, 2016 @01:57PM (#12277510)
Does that spec forces you to implement equality test between floating point numbers?
Re:Return True to Win by Zarel on Friday August 12, 2016 @03:33PM (#12278177)
...yes? I'm not sure exactly what you're asking here, though.
Re:Return True to Win by astrobe_ on Friday August 12, 2016 @07:56PM (#12279554)
I'm asking if it is really a good idea for a language to provide equality/inequality for floating point numbers when it's often mistake to do that.
Re:Return True to Win by Myrmornis on Friday August 12, 2016 @08:59PM (#12279709)
So disallow the direct operator but allow equality to be deduced indirectly by usage of > < >= <= ?
Re:Return True to Win by teraflop on Friday August 12, 2016 @10:58AM (#12276215)
That one isn't specific to Javascript, though. If you can find a mainstream language that doesn't have any values that aren't equal to themselves, I'll give you a cookie.

(Going from memory of the last time I tried this challenge, since I can't get it to load at the moment.)

Re:Return True to Win by posterboy on Friday August 12, 2016 @12:13PM (#12276772)
The important property of evaluation is determinism defined by the equality of the output. Classically, id(x) != id(x) is logically inconsistent.

Boolean Logic and natural languages are pretty mainstream in my opinion. Do you mean programming languages? If IEEE whatsthenumber is implemented in the FPUs to provide fcmp (Floating-point Compare Instruction), the languages don't have much of a choice.

When there are different types of equality, ie. compare instructions, you have no equality. That's maybe a bit binary. I'm sorry, I thought this was Computer Science.

Re:Return True to Win by Etzos on Friday August 12, 2016 @02:57PM (#12277943)
You seem to be splitting hairs and I'm not entirely sure why. Following the flow of conversation it should be pretty easy to infer the parent was referring to programming languages. Originally you said you don't think there should be a solution to the reflexive problem, and that in reply to a comment mentioning that Javascript was ugly (which is where the context of _programming_ language came from). I, and I believe the parent as well, took that to mean that you consider Javascript ugly because you don't believe it should operate the way it does. However, the point the parent was trying to make is that this is something common to all (programming) languages which follow the IEEE 754 standard and is therefore not some special case which makes Javascript any more ugly than another (programming) language.

It may not seem obvious and it may seem logically inconsistent but, like you said, this is computer science and things don't always work exactly the way we think they should. Usually because the obvious logical solution has problems when implemented so we change things around. In this case, NaN != NaN because of some of the limitations at the time IEEE 754 was proposed.

Re:Return True to Win by posterboy on Friday August 12, 2016 @11:18PM (#12280084)
No, of course that was news to me. But I am not advocating any programming language. This looks like a wart, but a compelling one to commit to, because it's a simple solution.

> It may not seem obvious and it may seem logically inconsistent but, ...

An if an argument is made in defense of inconsistent logic, how could the argument be expected to be logically consistent?

Your argument by authority is not very good. There are involved explanations on stackoverflow.com, but I didn't bother to read, yet. Another solution would be to set the carry flag.

Re:Return True to Win by lake99 on Friday August 12, 2016 @03:25PM (#12278126)
> Classically, id(x) != id(x) is logically inconsistent.

Equality is domain dependent. For example ∞!=∞ could be justified, as can (0/0)!=(0/0). In the domain of real numbers, equality can be an undecideable problem[1]. I guess the designers of these languages had to choose between tolerable defaults or throwing exceptions. I'm happy with JS doing this:

    % node
    > 1.0/-0
    -Infinity
    > 1.0/0
    Infinity
    > 0/0
    NaN
    > 0/NaN
    NaN
    > 1+NaN
    NaN
[1] https://math.stackexchange.com/questions/143727/determining-...
Re:Return True to Win by tomelders on Friday August 12, 2016 @09:04AM (#12275249)
Swift. The Javascript of tomorrow, today!
Re:Return True to Win by k_bx on Friday August 12, 2016 @09:28AM (#12275427)
PureScript. The Swift of today. Yesterday, today and tomorrow!
Re:Return True to Win by tomelders on Friday August 12, 2016 @09:37AM (#12275485)
But it compiles to ES5. At this rate, we'll be deploying ES5 for the rest of human history while we all pretend we're writing ES451.

And it's whitespace significant, which is something only maniacs like in a programming language.

I'm half joking, don't get too offended...

But whitespace significance is madness.