x86上的三角指令有什么错误? [英] What is the error of trigonometric instructions on x86?

查看:59
本文介绍了x86上的三角指令有什么错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在哪里可以找到有关x86处理器上三角函数指令的错误范围的信息?

Where can I find the information about error ranges for trigonometric function instructions on x86 processors?

推荐答案

您提出的问题很少是一个有趣的问题,并且您很可能真的想知道一些不同的东西.因此,让我先回答不同的问题:

What you ask is rarely an interesting question, and most likely you really want to know something different. So let me answer different questions first:

如何以一定的精度计算三角函数?

只需使用更长的数据类型.使用x86,如果需要具有双精度的结果,请进行80位扩展的双精度计算,这是安全的.

Just use a longer datatype. With x86, if you need the result with double accuracy, do an 80-bit extended double calculation and you are on the safe side.

如何获得与平台无关的准确性?

为此,您需要专门的软件解决方案,例如 MPFR

You need a specialized software solution for this, like MPFR

话说回来,让我回到您的原始问题.简短答案:对于较小的操作数,通常应在1 ulp以内.对于较大的操作数,情况越来越糟.唯一可以确定的方法就是亲自测试一下,就像这个家伙所做的那样.没有来自处理器供应商的可靠信息.

That said, let me come back to your original question. Short answer: for small operands it should be typically within 1 ulp. For larger operands it's getting worse. The only way to find out for sure is to test this for yourself, like this guy did. There is no reliable information from the processor vendors.

这篇关于x86上的三角指令有什么错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆