3 ms·
This is a rather poor rant. There's pretty much an easy answer to everything he describes that's been done in the academic world, and in other programming langu
by Sanddancer 12y ago
This is a rather poor rant. There's pretty much an easy answer to everything he describes that's been done in the academic world, and in other programming languages for decades, and almost certainly in his own programming language for similar problems.
Can I copy it into my own spec or would that be
copyright infringement? Can I write something myself
that means the same? Or do I have to link to the spec
and require my users to pay to read it?
Giving a summary is allowed even in the most draconian of interpretations of copyright. More loosely, pulling a quote of a few lines is standard for any sort of academic exercise; essays on novels certainly don't have you pull out the novel when they want to quote a bit of text.
What if your language doesn’t have exceptions? What
does it mean to provide a status flag?
You certainly have places elsewhere in your language for handling errors. How do you handle integer divide by zero? How do you handle timeouts when doing networking? How do you handle disk full errors? I hope you don't go stomping along after an error in those cases.
This may have made sense at the time of the original
spec in 1985 but it’s mutable global state – something
that has long been recognized as problematic and which
languages are increasingly moving away from.
This is because statelessness is a leaky abstraction. Your machine's saving to disk, it's allocating memory for other things, it's pulling in stuff and shooting stuff over the network. Floating point has lots of knobs that you need to turn because there are various rounding rules for various problem domains. You've almost certainly got a type system for your language, perhaps your answer is to create, or have a way to create, a floatRoundUp type for when a user needs to go beyond your default rules. In a pure functional definition, I think one way to consider the problem is to think of a floating point type as the actual number and the state registers. If you don't care, then just use the number part, if the state register matters, put those in too. Saving flags means that you can get repeatability. With a given set of flags, you'll always get the same answer.
Program block? Attribute specification? Nothing else in
my language works this way. How do I even apply this in
practice? If attributes are lexically scoped then that
would mean rounding modes only apply to code textually
within the scope – if you call out to a function its
operations will be unaffected. If on the other hand
attributes are dynamically scoped then it works with
the functions you call – but dynamically scoped state
of this flavor is really uncommon these days, most
likely nothing else in your language behaves this way.
There are two ways of handling this problem. Decide for the user, or expose the functionality needed to provide scoped floating point. The most "pure" way sounds like using the aforementioned type system to give defaults, but have a way for the user to tweak the rules as needed. You're the designer, one of your jobs is to make these sorts of decisions for the user. Things like your i/o library probably have similar problems, I don't see why floating point is all that much different.
- wpietri 12y agoA quick explanation of my downvote: You seem to be mistaking "I know the answer" for "everybody should know the answer". You could have written basically the same reply, but starting out with, "Hey, those are good questions. Because of my time in the academic world, I happen to know some of the answers. Let me see if I can help." But instead you had to be a dick. That's undeniably fun, but contempt for people asking reasonable questions doesn't make them smarter; it just stops them from asking questions.
- Sanddancer 12y agoI think what set me off was certain statements that he was coming from a position of authority, like that he was a language design guy. At the same time, he didn't give any statements to back up how deeply he's researched the issues. For example, there's no discussion of C's fenv.h, or how fortran's IEEE intrinsics work. Add to that the jabs on the age of the specification, and it just ended up giving the feeling of being a much more shallow piece than it could have been; it just felt like he was saying, "I don't know what to do. Internet, decide for me."
- plesner 12y agoI'm not claiming authority. What I'm saying is: there are two camps, the FP guys and the language guys, and there's not a huge amount of overlap. I belong to the language camp.
- wpietri 12y agoI thought it was mainly a post about how he personally found this standard frustrating. And I started getting that impression about the time I read the title, "Why I find IEEE 754 frustrating". The guy has a reasonable background as a language guy. He was trying to deal with the spec; he's allowed to opine on it. That you felt things? Those are your feelings. That you think he should be obliged to address your personal concerns preemptively? That's your problem, not his. If you want to know how deeply he's researched the issues, you could say, "Hey, have you looked at C's fenv.h?" Rather than just assuming the answer that lets you be a dick.