由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 一个小问题
相关主题
问个double和long double的问题问几个问题
一般来说浮点数乘法和除法哪个快?请教:double比float算起来还快?
logarithm and product, which is faster?float -> double, double -> long double (C++)
python 3 双/ 的意思。。。ugly in the hell....double's equality
HOW TO round float numbers to integer? in C一个dot net浮点运算的问题
[合集] c/c++ simple question: efficiency of array/buffer accespointer overflow
借人气问个c++的overflow (转载)a question about bitwise operation
python 问题教授的问题(C language)
相关话题的讨论汇总
话题: faster话题: jul话题: thu
进入Programming版参与讨论
1 (共1页)
J*****n
发帖数: 48
1
【 以下文字转载自 Computation 讨论区 】
发信人: Jackson (Stephen), 信区: Computation
标 题: 一个小问题
发信站: BBS 未名空间站 (Thu Jul 5 20:48:12 2007), 转信
double 类型 x,y
(y/x)/x 是不是比 y/(x*x) 更加好一些?
t****t
发帖数: 6806
2
1. mathematically, they are the same
2. programatically, 2nd is faster
3. numerically, they are not equivalent
so, how do you define "better"?

【在 J*****n 的大作中提到】
: 【 以下文字转载自 Computation 讨论区 】
: 发信人: Jackson (Stephen), 信区: Computation
: 标 题: 一个小问题
: 发信站: BBS 未名空间站 (Thu Jul 5 20:48:12 2007), 转信
: double 类型 x,y
: (y/x)/x 是不是比 y/(x*x) 更加好一些?

q****m
发帖数: 153
3
why the 2ns is faster?

【在 t****t 的大作中提到】
: 1. mathematically, they are the same
: 2. programatically, 2nd is faster
: 3. numerically, they are not equivalent
: so, how do you define "better"?

c*****z
发帖数: 182
4
莫非你的意思是第一种可以避免overflow?

【在 J*****n 的大作中提到】
: 【 以下文字转载自 Computation 讨论区 】
: 发信人: Jackson (Stephen), 信区: Computation
: 标 题: 一个小问题
: 发信站: BBS 未名空间站 (Thu Jul 5 20:48:12 2007), 转信
: double 类型 x,y
: (y/x)/x 是不是比 y/(x*x) 更加好一些?

l***i
发帖数: 8
5

要看具体的情况.
因为除法总归是比乘法计算量大.如果对real time要求很高,后者好一点。
但是double和float都有数据的表示误差。如果x是很小的数,x*x就丢失精度。
总之具体问题具体分析。看看数据是什么,要求是什么,target的性能,对数据格式的
支持(例如TI有自己的float格式)。

【在 J*****n 的大作中提到】
: 【 以下文字转载自 Computation 讨论区 】
: 发信人: Jackson (Stephen), 信区: Computation
: 标 题: 一个小问题
: 发信站: BBS 未名空间站 (Thu Jul 5 20:48:12 2007), 转信
: double 类型 x,y
: (y/x)/x 是不是比 y/(x*x) 更加好一些?

k****f
发帖数: 3794
6
用FPU的话,乘法除法计算量应该差不多的?

【在 l***i 的大作中提到】
:
: 要看具体的情况.
: 因为除法总归是比乘法计算量大.如果对real time要求很高,后者好一点。
: 但是double和float都有数据的表示误差。如果x是很小的数,x*x就丢失精度。
: 总之具体问题具体分析。看看数据是什么,要求是什么,target的性能,对数据格式的
: 支持(例如TI有自己的float格式)。

x******g
发帖数: 3952
7
除法还是比乘法慢的。

【在 k****f 的大作中提到】
: 用FPU的话,乘法除法计算量应该差不多的?
1 (共1页)
进入Programming版参与讨论
相关主题
教授的问题(C language)HOW TO round float numbers to integer? in C
[合集] Python下面如何进行numeric analysis and statistical analysis[合集] c/c++ simple question: efficiency of array/buffer acces
c++ class design issue借人气问个c++的overflow (转载)
来来来,我也问个题 (转载)python 问题
问个double和long double的问题问几个问题
一般来说浮点数乘法和除法哪个快?请教:double比float算起来还快?
logarithm and product, which is faster?float -> double, double -> long double (C++)
python 3 双/ 的意思。。。ugly in the hell....double's equality
相关话题的讨论汇总
话题: faster话题: jul话题: thu