You are a stupid programmer, you can't have that

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Aug 9 17:03:57 UTC 2021


On Mon, Aug 09, 2021 at 04:14:49PM +0000, Mark via Digitalmars-d wrote:
[...]
> Isn't unsigned math exist because we are limited in how many bits the
> number can hold? There's no concept of signed/unsigned for
> float/double/real. Which one is simpler that would introduce less
> complexity for the programmer writing code?

Floating-point, if anything, is *more* complex and comes with more
pitfalls than signed/unsigned mistakes. Worse yet, it *appears* to
behave like what most people imagine real numbers to behave, but in fact
doesn't, which makes mistakes more likely, and also harder to catch
because they usually only crop up in special corner cases while
generally appearing to work correctly.

Cf.: https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

At the end of the day, it boils down to: you have to learn how your
programming language and its types work. If you imagine you can just
cowboy your way through programming without fully understanding what
you're doing, you only have yourself to blame when the results are
disappointing.

As Walter once said:

	I've been around long enough to have seen an endless parade of
	magic new techniques du jour, most of which purport to remove
	the necessity of thought about your programming problem.  In the
	end they wind up contributing one or two pieces to the
	collective wisdom, and fade away in the rearview mirror.
	-- Walter Bright


T

-- 
Windows 95 was a joke, and Windows 98 was the punchline.


More information about the Digitalmars-d mailing list