基于浮动的数学课。它存在吗? [英] Float based math class. Is it exist?

查看:52
本文介绍了基于浮动的数学课。它存在吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

float sum =(float)Math.Sqrt(floatA * floatA + floatB * floatB);


我正在使用带有c#的DirectX。但是.net框架中的Math类有一个

问题。它是双重的基础!


所以我正在用Math类进行每行的类型转换。


是否有基于数学库的浮点数?

float sum = (float)Math.Sqrt( floatA*floatA + floatB*floatB);

I''m using DirectX with c#. But the Math class in .net framework has a
problem. It is "double" base!

So I''m doing type casting every line with Math class.

Is there any Math library float based?

推荐答案

ki ****** @ hanmail.net 写道:
ki******@hanmail.net wrote:
float sum =(float)Math.Sqrt(floatA * floatA + floatB * floatB);

我我正在使用带有c#的DirectX。但是.net框架中的Math类有一个问题。它是双重的基础!

所以我正在使用Math类进行类型转换。

是否有基于数学库的浮点数?
float sum = (float)Math.Sqrt( floatA*floatA + floatB*floatB);

I''m using DirectX with c#. But the Math class in .net framework has a
problem. It is "double" base!

So I''m doing type casting every line with Math class.

Is there any Math library float based?




我不认为有类似替代Math类的东西使用

float而不是double,no。


我假设可能存在一个用例,其中一个真的,明确地不是
想要在float类型上增加double类型的精度。但在大多数情况下,我会说你为什么不用两种类型的b / b
进行计算,使用额外的精度来获得优势,然后

当你将它们传递到

需要浮点类型的界面时,只抛出一次值?这是不是一种有用的方法出于某种原因我不能看到你好吗?


Oliver Sturm

-

omnibus ex nihibo ducendis sufficit unum

插入空格以防止谷歌电子邮件销毁:

MSN oliver @ sturmnet.org Jabber sturm @ amessage.de

ICQ 27142619 http://www.sturmnet.org/blog


嗨!
需要浮点型吗?这是不是一种有用的方法,因为某些原因我没有看到?
needs a float type? Is that not a usable approach for some reason I''m
not seeing?




浮点精度数学比双倍快约2倍。

问候!

Atmapuri



Float precision math is approx 2x faster than double.
Regards!
Atmapuri


Atmapuri< ja ************ @ usa.net> ;写道:
Atmapuri <ja************@usa.net> wrote:
需要浮点型吗?这是不是一种有用的方法,因为某些原因我没有看到?
needs a float type? Is that not a usable approach for some reason I''m
not seeing?



浮点精度数学比双倍快约2倍。



Float precision math is approx 2x faster than double.




可能在您的计算机上 - 当然不是在所有计算机上,并且

可能甚至不在您计算机上的所有操作中。我已经看过

示例,其中使用float实际上比double慢,因为

处理器在内部进行了双重计算,并使其成为

float只是两次转换的开销。


-

Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet

如果回复该团体,请不要给我发邮件



Possibly on your computer - certainly not on all computers, and
probably not even on all operations on your computer. I''ve seen
examples where using float was actually slower than double, because the
processor was doing a double calculation internally, and making it
float just incurred the overhead of conversion both ways.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


这篇关于基于浮动的数学课。它存在吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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