Slashdot is powered by your submissions, so send in your scoop


Forgot your password?

Slashdot videos: Now with more Slashdot!

  • View

  • Discuss

  • Share

We've improved Slashdot's video section; now you can view our video interviews, product close-ups and site visits with all the usual Slashdot options to comment, share, etc. No more walled garden! It's a work in progress -- we hope you'll check it out (Learn more about the recent updates).


Comment: Re:Not that easy to see (Score 1) 53

by Bruce Dawson (#48890477) Attached to: Rare Astronomical Event Will See Triple Moon Shadows On Jupiter

> who've either spent thousands on astrological equipment

Well there's your problem -- you should have been focusing on telescopes instead of the Zodiac.

I've got a 6" Dobsonian telescope -- not terrifically expensive, under $1,000 I'm sure -- and I've enjoyed Jupiter moon transits before. It's no Hubble, but I enjoy it.

Comment: Re:Almost, but not really (Score 1) 61

> the human eye has difficulty seeing more than 60hz.

Not true. And, a broad claim like that conflates many different concepts. Flicker fusion can require 85 Hz to not cause headaches for some people (especially with the low persistence needed for non-blurry VR), and smooth motion continues to feel smoother up to at least 120 Hz.

In addition, lower frame rates generally mean increased latency, and latency is probably the biggest cause of VR nausea.

But don't take my word for it. This blog post does a great job of summarizing the latest research on the topic:

I have no idea what cheap CPUs and server I/O have to do with motion tracking, but tracking a single point (translation and rotation) is exactly what is needed for VR -- that point is the user's head, and tracking it with low latency is what makes VR work.

> The only difference between now and 20 years ago...

is everything. The technology is orders of magnitude cheaper and more capable.

Comment: Re:C versus Assembly Language (Score 1) 226

by Bruce Dawson (#48725533) Attached to: Red Hat Engineer Improves Math Performance of Glibc

What about the add with carry? That's the particularly hairy bit. Even if clang/gcc/VC++ recognize the pattern and turn it into optimal code, add with carry is a case where assembly language is cleaner and more elegant than the equivalent high-level language code.

I'm not a fan of inline assembler because it often gives you the worst of both worlds -- incomplete control over code generation, and worse syntactic messiness than pure assembly language. But yes, a mixture of C++ and assembly is definitely the right solution, either inline assembly or a single separate function to do the messy math.

Comment: Re:Let the games begin (Score 1) 226

by Bruce Dawson (#48723539) Attached to: Red Hat Engineer Improves Math Performance of Glibc

Actually the trend is in the opposite direction -- fewer of the math functions are implemented in hardware than used to be. There are many reasons (optimized out-of-order CPUs and old/slow transcendental implementations) but one significant reason is that the new glibc math functions are generally correctly rounded -- exactly correct. Whereas the hardware versions are often not -- as I discussed in this recent blog post:


Comment: Re:C versus Assembly Language (Score 1) 226

by Bruce Dawson (#48723499) Attached to: Red Hat Engineer Improves Math Performance of Glibc

High-precision math is an excellent time to use assembly language. Assembly languages generally have a way to express ideas like a 32x32->64-bit multiply (and 64x64->128-bit multiply), and add-with-carry. High-level languages generally support neither of those options directly. To tell the compiler that you want a 32x32->64-bit multiply you generally have to have two 32-bit inputs, then cast one of them to 64-bit, and hope that the compiler doesn't actually generate a 64x64 multiply.

For 64x64->128-bit multiplies the problem is more difficult because many languages don't have a 128-bit type, and yet these multiplies are crucial for getting maximal multi-precision performance on x64.

Without access to the carry flag a programmer in a high-level language has to do things like:

a0 += b0;
if (a0 https://randomascii.wordpress....

Comment: High time to stop lowering gas taxes (Score 1) 554

by Bruce Dawson (#48395491) Attached to: The Downside to Low Gas Prices

As the article mentions, inflation adjusted gas taxes have been dropping for 21 years. That doesn't make sense. At the very least they should be returned to their 1993 levels and indexed for inflation. Roads are crowded and a gas tax would relieve that by encouraging alternatives. It would also reduce pollution, reduce carbon emissions, reduce oil imports that kill the balance of trade and finance people who use the money to try to kill us.

Gas taxes really are good.

As to the complaints that the gas taxes are being used to fund other things, such as bicycle paths and mass transit -- I'm not sure how true that is, but you would be foolish to fight it. Alternatives to driving are crucial. Paving huge amounts of land makes walking and biking very difficult so drivers *owe* the non-drivers a bit of help. And drivers benefit *greatly* from mass transit. With no mass transit the traffic congestion would be even worse.

And, given that drivers park free almost everywhere it is truly rich to hear drivers complaining about having to subsidize transit. The implicit subsidy that cars get through free parking is orders of magnitude greater (read "The High Cost of Free Parking" for all the details).

Comment: Re:Basic maths required. (Score 1) 239

by Bruce Dawson (#48213085) Attached to: Where Intel Processors Fail At Math (Again)

It is of course well known that, for double precision, sin(x) == x if x 1.49e-8. They teach that in kindergarten these days.

However the article is about sin(double(pi)), and pi is actually greater than 1.49e-8. Therefore range reduction needs to be done, and that is where things go awry.

Yes, the caller could do the range reduction, but this is not trivial to do correctly and it really should be done by the sin() function. With glibc 2.19 it is.

Comment: Re:Exact mathematical value isn't the ideal (Score 1) 239

by Bruce Dawson (#48122013) Attached to: Where Intel Processors Fail At Math (Again)

But the parent you refer to (this comment's great grandparent?) says "Any serious calculation requires an error calculation to go with it." Sure. I can agree with that.

And that's the whole point of the article. If somebody does an error calculation based on Intel's documentation then they will have an incorrect error calculation -- in some cases grossly incorrect. So the claim that an error calculation is needed actually *supports* the article (mine, BTW), while arguing against it.

I think ledow is violently agreeing with my article, perhaps without realizing it.

Comment: Re:Article is wrong - it is documented (Score 1) 239

by Bruce Dawson (#48121995) Attached to: Where Intel Processors Fail At Math (Again)

As the other reply said, the function contract and an explanation of the implementation are different beasts. The Intel manual said that fsin is accurate across a huge range of values. Elsewhere the Manual hinted at Intel's range reduction algorithm such that a numerical analyst could suspect that there was a problem. So, to a numerical analyst the documentation was contradictory. To anybody else it was clear -- guaranteed one ulps precision. The documentation was therefore at best misleading, but for most people it was just wrong. Linus Torvalds was fooled, for example.

> If you let x = pi, then people would ordinarily expect that sin (x) = 0.

Many people would expect that, although the article (my article) most certainly did not expect that.

The calculation being done in the article takes into account the fact that double(pi) is not the same as the mathematical constant pi and it uses that and the properties of sine to measure the error in double(pi). This is an unusual but perfectly reasonable calculation to make. It failed because of the limitations of fsin. Those limitations are contradictory to the documentation. Hence the article.

> A more precise approximation according to Wikipedia would have been...

You don't need to go to Wikipedia, you just have to RTA. It lists a 192-bit hexadecimal approximation of pi.

> The reality is that the correct result would have been zero

No. Zero is the correct answer if doing symbolic or infinite precision math, but I did not make that assumption because I was doing double-precision math.

Comment: Re:FPUs are **inherently** approximations (Score 1) 239

by Bruce Dawson (#48117395) Attached to: Where Intel Processors Fail At Math (Again)

There's an alternate test that works on the Windows 7 calculator to show that it is not implemented on the FPU. Calculate square root of four, and then subtract two. You should get zero but you don't.

That is an error that no FPU would make. The IEEE standard requires a correctly rounded result for square root, and the Windows 7 calculator fails to deliver that on even very simple inputs like four. The Windows 7 calculator does its calculations to more digits of precision than double precision, but it doesn't do its calculations accurately. Oops.

Comment: Re:example from TFA. try it (Score 1) 239

by Bruce Dawson (#48117367) Attached to: Where Intel Processors Fail At Math (Again)

How would you like that example number to be given? In hexadecimal for maximum readability? Giving it in decimal is necessary for communicating the issue.

But the reality is that that number can show up during calculations. Intel promises to calculate it's tangent to a specific precision, but Intel's documentation is incorrect. That is the problem -- hugely misleading documentation.

The issue of not being able to fully specify a particular real number is actual crucial to the article though, but in a different way. The example is sin(double(pi)), what it should be, what that should allow, and how that fails. You should read the article. I think it's excellent.

Comment: Re:Exact mathematical value isn't the ideal (Score 1) 239

by Bruce Dawson (#48117331) Attached to: Where Intel Processors Fail At Math (Again)

> Any serious calculation requires an error calculation to go with it.

Sure. That sounds good. And in order to make that error calculation you need to consult the documentation to know how accurate the instructions you are using are. Let me see -- Intel says that fsin is accurate to one ULP. That's sufficient. Error calculation done.

That's why the inaccuracies in their documentation matters.

> I'll tell you now that I wouldn't rely on a FPU instruction to be anywhere near accurate.

Really. Well that seems foolish. As required by the IEEE standard the x87 FPU supplies correctly rounded results for add, subtract, multiply, divide, and square root. At double and long-double precision you can't do better. Those can be composed into higher-level functions with well defined accuracy if you know what you are doing.

It's funny that there is one group of people asking when this tiny error could even matter ( and another group saying that even without this error the precision is insufficient. You guys should talk.

Comment: He measured single-threaded compiles?!!! (Score 2) 132

by Bruce Dawson (#45535705) Attached to: Speed Test 2: Comparing C++ Compilers On WIndows

Visual C++ has this handy /MP option which tells the compiler to do multi-threaded compiles. On some of our build machines (with 16 cores) this gives an almost linear increase in build speeds. It's obvious from the author's discussion of multi-core that he is not aware of this option and did not use it.

A performance benchmark which doesn't turn on the go-fast option is not going to produce meaningful results.

The author also doesn't discuss debug symbols. VC++ generates debug symbols by default, whereas the other compilers do not. Generating builds without symbols is not a reasonable scenario for most builds, so this makes the file size comparisons rather meaningless.

Information is the inverse of entropy.