Live data from Hacker News

John Gustafson’s crusade to replace floating point with something better

nextplatform.com

51–60 of 201 posts

Re: John Gustafson’s crusade to replace floating point with something better

#51
post #5

Obviously for any 32 bit value there’s only 2^32 possible values. So logically, a better number format is all about the distribution of values and reducing redundancy. It sounds like the basic idea here is that rather than a fixed amount of significant figures, you get more precision in the middle. Meanwhile, you can also get larger exponents. Is that right?

I believe this has even fewer allowable states because there's more than one way to represent the same number

Re: John Gustafson’s crusade to replace floating point with something better

#53

The paper for this was published in 2017[0] [0] https://dl.acm.org/citation.cfm?id=3148220

It's odd. Someone told me about that on irc at the Time. People were feeling strongly about the topic. Quackery, mythomany,.. nobody wanted to hear about anything but IEEE standards.

> Quackery, mythomany,.. nobody wanted to hear about anything but IEEE standards.

Mostly because there is no good evidence that what is being proposed is better.

This isn't the olden days when it was difficult to demonstrate on a large enough CPU and dataset. Today we have cloud computing. If you create something better, you can demonstrate it by putting it into a numerics application and blow everybody away.

The CFD people are always looking for better solutions. The numerical simulation people are always constrained.

Until you do that, people have a right to blow you off.

Re: John Gustafson’s crusade to replace floating point with something better

#54
post #7

How does the implementation of an FPU for this compare? I thought the existing IEEE 754 floating point standard was focused on reduced complexity of addition and multiplication hardware. This seems more complicated.

having implemented it, with unoptimized verilog (ok, i wrote a verilog generator to generate it), it requires about 30% fewer LUTs on a FPGA relative to berkeley hardfloat implementation.

Is the variable length regime handling that much easier to deal with (space-wise) than the NaN and subnormal handling needed in IEEE floats? I'd think that the regime scheme would effectively be equivalent to creating a multitude of different-width subnormal routes. Is it really the NaN handling that kills IEEE float performance?

Re: John Gustafson’s crusade to replace floating point with something better

#55

Earlier quoted context omitted.

Yes and no. 1. Yes -- On old x86 systems, the x87 registers were 80-bits and the bottom bits were undefined. You could theoretically have a 1-bit difference on some results depending on what the bottom 26 bits (that were undefined, because you had 64-bit floats most of the time, even though the machine did things 80-bits at a time). 2. No -- Modern x86 systems use SSE registers, which are 64-bits. There are a whole s…

In case you're like me, reading this comment and thinking "how the heck is 1 plus 1 plus 2-ish like 90 gazillion?", it's: >>> (1+1)+2.0**53 9007199254740994.0 >>> 1+(1+2.0**53) 9007199254740992.0 The exponent operator (double star) got transformed into italics apparently.

Oh! Thank you! The comment makes a lot more sense now!

The newlines also helped, by the way, because I was wondering what putting the two numbers next to each other was meant to indicate.

Re: John Gustafson’s crusade to replace floating point with something better

#56
post #4

Here is the official site[1] of the project. There is a request[2] to add it in the Scryer Prolog[3] (ISO Prolog implementation in Rust). And implementations in Rust[4] itself, and Julia[5] language. [1] https://posithub.org/index [2] https://github.com/mthom/scryer-prolog/issues/6 [3] https://github.com/mthom/scryer-prolog [4] https://gitlab.com/burrbull/softposit-rs [5] https://juliacomputing.com/blog/2016/03/29/un…

That's great, but if the hardware doesn't support it, then wouldn't the implementation would be slow?

Yes, those implementation are slow compared to classical floating points. The goal, as I understand it, is to let people experiment with Posits in order to prove that they bring something to the table.

Re: John Gustafson’s crusade to replace floating point with something better

#57
post #33

Earlier quoted context omitted.

Nothing in between the assignment and the check changed the value of x or y What was the check for?

There was code in between that could have changed the value, but it was never triggered in the bug case.

Ah yeah, that makes sense. Relying on FP equality should always make one's eye twitch a little but this is a neat way of hiding it.

Re: John Gustafson’s crusade to replace floating point with something better

#58
post #35

Earlier quoted context omitted.

UNIX timestamps are normally stored as 32-bit or 64-bit signed integers, not as floating-point. If you want better than 1-second precision, then the type "struct timespec" (specified by POSIX) gives you nanosecond precision. Fixed-point types can also be used in languages that support them.

I thought unsigned in 64 bits, holding the number of nanoseconds since the Unix 0 time (which might be 1970, but i forget).

UNIX time is seconds since epoch (hence year 2038, that's the limit for a signed 32b time_t).

gettimeofday() and clock_gettime() provide higher resolution timestamps (respectively µs and ns), using typedefs instead of just numbers.

Some APIs return floating-point UNIX time in order to provide sub-second accuracy (the decimal part is the fractional second). Python's time.time() does that for instance.

Re: John Gustafson’s crusade to replace floating point with something better

#59

"(even the same computation on the same system can produce different results for floats)" wait...what? Is this real?

Yes and no. 1. Yes -- On old x86 systems, the x87 registers were 80-bits and the bottom bits were undefined. You could theoretically have a 1-bit difference on some results depending on what the bottom 26 bits (that were undefined, because you had 64-bit floats most of the time, even though the machine did things 80-bits at a time). 2. No -- Modern x86 systems use SSE registers, which are 64-bits. There are a whole s…

Wrt #3, I've had huge errors (I think on the order of 10e-3) in non linear curve fitting spectroscopy algorithms because of this. One of the physics research fellows in the group looked at me like I was an idiot for not knowing the order of multiplication mattered (I still have no clue why he would think it's a standard thing to know this).

Re: John Gustafson’s crusade to replace floating point with something better

#60

Earlier quoted context omitted.

Yes and no. 1. Yes -- On old x86 systems, the x87 registers were 80-bits and the bottom bits were undefined. You could theoretically have a 1-bit difference on some results depending on what the bottom 26 bits (that were undefined, because you had 64-bit floats most of the time, even though the machine did things 80-bits at a time). 2. No -- Modern x86 systems use SSE registers, which are 64-bits. There are a whole s…

> Modern x86 systems use SSE registers Are your sure of this? It's my understanding that SSE registers require the use of a special API and standard floating point operations do not use them. But the last time I worked with them was writing a SIMD vector library 7 years ago.

> It's my understanding that SSE registers require the use of a special API and standard floating point operations do not use them.

No, SSE registers are used by most compilers that do floating point these days. They support all the usual IEEE float math operations and a host of bit twiddling operations as well as vector operations. The vector operations do still require using compiler intrinsics in C++, although some autovectorization does occur in gcc, icc, and llvm.

Post reply on HN