Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Floating-point numbers are NOT real numbers!

Name: Anonymous 2018-07-14 14:39

In every introduction to programming, one has to see the author spout this nonsense. Never mind that a format that represents every real number through a finite bit pattern is a simple mathematical impossibility[1] and doing it in a bit pattern of fixed length even more so; never mind that this supposedly-white lie breeds nothing but confusion when the newly-made programmer tries to do ``real'' arithmetic only to encounter seemingly random rounding errors and concludes that floating-point arithmetic is black magic that corrupts your digital fluids; never mind the staggering amount of subtly wrong programs that deal with fixed-point quantities like money through floating-point arithmetic when there was never any reason to have rounding errors enter the problem or solution.

Floating-point arithmetic is not difficult. It works like you'd do arithmetic on paper with a fixed amount of digits, except for the fact that your digits are binary and so the amount of rationals with finitely many digits is a bit smaller. There exist good texts on floating-point arithmetic, understandable even for the kind of mental midget that studies CS to write DISRUPTIVE ENTERPRISE NANOSERVICES nowadays. [2] was written in 1991 -- what's your excuse? If you want to understand the rounding behaviour better, every decent book on numerical analysis contains a section on it and books like Wilkinson's Rounding Errors in Algebraic Processes (1961) go even further into detail. Not that you need much beyond the trivially derived (even if coarse) bounds in anything that isn't a serious numerical problem; and if it is one, why the fuck did you not learn numerical analysis before tackling it?

Where does this fetishism for ignorance in programming stem from? Nowhere else have I seen a supposedly technical field that happily ignores its own history, takes pride in using something without having read as much as the goddamn manual (let alone a book) and outright teaches this ignorance.

[1] Yes, yes, the computable real numbers are by definition representable and a triple Shalom! to Cantor and the powerset axiom. While we wait for the system that represents every number as an algorithm producing its digits, let's keep things classical.
[2] https://www.itu.dk/~sestoft/bachelor/IEEE754_article.pdf

Name: Anonymous 2018-07-14 17:19

>>1
>Believing in "Real numbers"
https://www.youtube.com/user/njwildberger

Name: Anonymous 2018-07-14 19:09

What's the biggest number the universe could represent, if every particle that exists represents a binary 1, and every place a particle could technically exist represents a binary 0?

Name: Anonymous 2018-07-14 21:14

Computer integers are NOT real integers!

In every introduction to programming, one has to see the author spout this nonsense. Never mind that a format that represents every integer through a finite bit pattern is a simple mathematical impossibility...

Name: Anonymous 2018-07-15 0:24

>>4
Integers can be represented through bit patterns such that every number has a finite pattern. For real numbers, this is something the people who supposedly passed a class on calculus should be able to prove impossible by themselves.

However, it's true that you cannot have correct arithmetic on a computer without handling either overflow or OOM conditions and this is a big problem that most programming languages ``solve'' by simply ignoring it. Many lack even the most basic tools to deal with this is an ordered way: How many languages have only fixnums and no way to detect overflow unless you recompute the result yourself, even though basically all extant hardware detects it automatically? And yet C is ``close to the hardware'' according to some idiots. How many languages cannot react to OOM conditions, e.g. to allow you to drop caches? As far as I know not even Common Lisp can do that portably, though I might be wrong there. OOM handling in general is a place where the ``state of the art'' is abominably primitive even though it is a fundamental problem.

Name: Anonymous 2018-07-15 1:07

integers are real

you can't go to the store and buy 2.5 watermelons

Name: Anonymous 2018-07-15 4:32

>>6
They sell even 1/4 of watermelon or even slices. Full watermelons can't fit a fridge shelf(thats btw why japanese grow cubic watermelons).

Name: Anonymous 2018-07-15 6:01

>>7

go to a store and see if they will sell you half a bag of chips or 3.5 cigarettes from a pack

some things are only divisible in theory, not reality

grocery shopping requires floor division

Name: Anonymous 2018-07-15 6:27

>>3
Probably a lot less than unrolling the universe into 1D, assigning each particle a unique id and treating it as a giant factorial

Name: Anonymous 2018-07-15 6:57

>>9
assigning each particle a unique id
but where would you store it? that would be more storage space
my idea can be stored because existence/non-existence is the storage medium

didn't you ever take a data structures and algorithms class where they go over algorithms and array copies for swapping etc and the trade-offs between time complexity and resource usage?

Name: Anonymous 2018-07-15 7:10

>>11
hidden local variables, of course!

Name: Anonymous 2018-07-15 12:47

>>7
thats btw why japanese grow cubic watermelons
What?

Name: Anonymous 2018-07-15 14:02

>>5
How many languages cannot react to OOM conditions, e.g. to allow you to drop caches? As far as I know not even Common Lisp can do that portably, though I might be wrong there. OOM handling in general is a place where the ``state of the art'' is abominably primitive even though it is a fundamental problem.
PL/I handles this by raising the STORAGE condition (or AREA condition if allocating in an area). Each procedure call or block activation can be associated with a handler for each condition. Handlers are enabled by the ON statement, which can be controlled conditionally because it's a statement like I/O and assignment. After the condition is handled by an ON STORAGE statement, and if the handlers return normally, the allocation is retried. If there's still not enough memory, the condition is raised again. PL/I has lexical scope and does not unwind the stack so these handlers can change variables in their scope, like freeing memory and setting variables to tell what has been freed. Eventually, if there are no more handlers and still insufficient memory, there is some system-specific action, like printing a stack trace or starting a debugger. The stack is still not unwound, so the debugger can fix a problem and continue.

Name: Anonymous 2018-07-15 16:16

>>13
That does sound pretty close to what I'm looking for, and pretty close to CL's restart system too for that matter. Are there resources you'd recommend? PL/I is not exactly flavor-of-the-month shit with ten million tutorials, and a first search doesn't yield too much. I don't mind terse detailed texts, so something like the Ada Reference would be fine as well.

Name: Anonymous 2018-07-15 16:35

>>5
The set of integers consists of infinite numbers of finite length each. Since memory is finite and things like ints in programming languages are actually finite cyclic groups you can't represent every integer - thus integers in computers are not integers but simply a subset of them.

Name: Anonymous 2018-07-15 17:01

you can't represent every integer
Arbitrary precision arithmetic

Name: Anonymous 2018-07-15 17:02

Name: Anonymous 2018-07-15 17:34

>>15
Nobody claimed a computer with a fixed finite amount memory could represent all integers.
Read the posts you're replying to before you try to be a pedant.

Name: Anonymous 2018-07-15 18:53

>>17
I'm not reading your pravdapedia bs.

Name: Anonymous 2018-07-15 19:47

>>19
non-political articles on wikipedia are okay
but anything relating to politics always have a leftist slant
try to edit anything and some loser liberal will revert your edit instantly

Name: Anonymous 2018-07-15 20:57

>>20
They are not okay. If you aren't knowledgable about a topic, you can't evaluate the quality of sources on it. Read an article on a topic you know about sometime and be amazed at how utterly fucking wrong, incomplete or badly explained everything is. Not even mathematics articles are safe, I've seen WP explicitly claim that a cryptosystem which is provably resistant to one attack is vulnerable to a weaker form of the same attack. ``Rice's theorem'' claimed for several years that it implied that detection of array bound violations is undecidable. It isn't even a semantic property, what sort of moron wrote this? Don't fall for the ``99% of vandalism and wrong info is quickly reverted'' meme, the only shit that is reverted is the one that doesn't matter. Misinformation stays there for years. Wikipedia is a massive turd. Edited on 15/07/2018 20:58.

Name: Anonymous 2018-07-15 21:02

>>21
I only care about politics, not your dumb nerd shit

Name: Anonymous 2018-07-15 21:44

>>18
I read it, OP just learned about hilbert's hotel in his kindergarden and decided to shitpost about it on /prog/.

Name: Anonymous 2018-07-15 21:57

>>23
you are retarded, hilbert's hotel has nothing to do with any of this

Name: Anonymous 2018-07-15 22:23

>>24
Never mind that a format that represents every real number through a finite bit pattern is a simple mathematical impossibility and doing it in a bit pattern of fixed length even more so

Name: Anonymous 2018-07-15 22:33

>>25
that refers to cantor's diagonal argument. retard.

Name: Anonymous 2018-07-16 3:35

>>21
I agree partially. Some articles are really good, but when people start contesting citations and removing material it could easily revert to early revision as consensus. And early revisions are often made by students with cursory knowledge of the topic.
For topics such as medicine and biology, there are lots of very opinionated articles with low-quality sources.
The worst articles are politics/social issues related, where people fight for every word and sentence.
You'll have to search history and talk pages to get clues about what parts of article are missing and why.

Name: Anonymous 2018-07-16 5:40

>>21
I've seen WP explicitly claim that a cryptosystem which is provably resistant to one attack is vulnerable to a weaker form of the same attack
Explain, which cryptosystem and what attack.

``Rice's theorem'' claimed for several years that it implied that detection of array bound violations is undecidable
Is it not? (assuming a Turing complete language and no extra stuff (such as dependant types) that lets you prove that you never access out of bounds at compile time)

It isn't even a semantic property
How is it not?

Name: Anonymous 2018-07-16 11:17

>>28
weaker form of the same attack
That was a bit misleading, I probably misremembered. ``Cramer-Shoup'' claimed that you could not split the plaintext and encrypt each text separately without losing security against chosen ciphertext attacks. Sources: None of course. Now, doing this is not a good idea for other reasons, but there doesn't need to be any relation between the two plaintext parts, so if you could break things this way, Cramer-Shoup would be hilariously insecure and definitely not secure against adaptive chosen ciphertext attacks as proven.

How is it not?
It isn't preserved under equivalence. For any program that doesn't violate bounds you can find an equivalent one that does: Violate bounds in a place that doesn't matter, then press on as normal. If this seems like a cheap trick to you, try to define what it means for a partial function \(f : \mathbb{N} \to \mathbb{N}\) to violate array bounds. If it's semantic, this must be possible.

Name: Anonymous 2018-07-23 10:49

>>1
Every floating point number (except for Infinity and NaN) is also real numbers. So, it is correct to say that floating point numbers are real numbers. However, the converse is not true: not every real number is a floating point number.

Name: Anonymous 2018-07-23 16:03

So, it is correct to say that floating point numbers are real numbers
No, due to infinity and NaN.

Name: Anonymous 2018-07-23 16:13

>>30
It's moar correct to say they're rational numbers.

Name: Anonymous 2018-07-23 17:03

>>32
Rational numbers are real numbers.

Name: Anonymous 2018-07-23 18:55

>>33
But real numbers are not necessarily rational numbers and there are no floating point numbers that are real but not rational.

Name: Anonymous 2018-07-23 20:54

Sure, and there are no real numbers that are rational but not real.

Name: Anonymous 2018-07-23 22:58

>>35
>there are no real numbers that are not real
Umm, yeah.

Name: Anonymous 2018-07-24 1:35

>>36
I meant floating point numbers, h-heh.

Name: Anonymous 2018-07-24 12:54

>>37
Even so, you're are pointing out a trivial case.

Don't change these.
Name: Email:
Entire Thread Thread List