再次浮点 [英] Floating point again

查看:135
本文介绍了再次浮点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天我问了一个浮点问题,我还有一个。我做了一些计算,我使用math.h中的结果(C语言)正弦,余弦和正切函数。

Yesterday I asked a floating point question, and I have another one. I am doing some computations where I use the results of the math.h (C language) sine, cosine and tangent functions.

一个开发商含糊地说,你必须要小心这些函数的返回值的,我不应该做出的GCC数学函数的返回值的假设。我不是要开始讨论,但我真的想知道我需要提防的标准数学函数做计算时。

One of the developers muttered that you have to be careful of the return values of these functions and I should not make assumptions on the return values of the gcc math functions. I am not trying to start a discussion but I really want to know what I need to watch out for when doing computations with the standard math functions.

X

推荐答案

您不应该期望罪(PI / 6)等于COS(PI / 3),例如。你也不应该期望ASIN(SIN(X))等于X,即使x是为罪域。他们会接近,但可能不会是平等的。

You should not expect sin(PI/6) to be equal to cos(PI/3), for example. Nor should you expect asin(sin(x)) to be equal to x, even if x is in the domain for sin. They will be close, but might not be equal.

这篇关于再次浮点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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