473,830 Members | 1,954 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Float based math class. Is it exist?

float sum = (float)Math.Sqr t( 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?

Nov 17 '05
17 11352
Thanks for your kindness and patience. ^_^

Nov 17 '05 #11
Thanks for your kindness and patience. ^_^

Nov 17 '05 #12
On Mon, 22 Aug 2005 17:12:23 +0200, "Atmapuri"
<ja************ @usa.net> wrote:
Float precision math is approx 2x faster than double.


Not on the Intel x86 architecture...
--
http://www.kynosarges.de
Nov 17 '05 #13
On Mon, 22 Aug 2005 17:12:23 +0200, "Atmapuri"
<ja************ @usa.net> wrote:
Float precision math is approx 2x faster than double.


Not on the Intel x86 architecture...
--
http://www.kynosarges.de
Nov 17 '05 #14
On Tue, 23 Aug 2005 06:22:46 +0100, Jon Skeet [C# MVP]
<sk***@pobox.co m> wrote:
In some 32-bit processors, I believe there is no microcode support for
performing some floating point operations in less than 80 bits. In
other words, everything's already being converted.


The FPU of the x86 line always performs calculations at 80 bit
precision, that's why you don't get any speedup for using float
instead of double (other than some memory transfer savings).

NB: In an earlier discussion I was notified that you can explicitly
put the FPU into 32-bit IEEE mode, but (a) I don't think it's actually
faster -- Intel just provides this feature to accomodate existing
programs; and (b) the .NET libraries don't use this mode anyway.

<ki******@hanma il.net> wrote:
2. There are two reasons why I want float based math
First, float precision math is 2x faster than double. It is said by
Atmapuri.


Tip: Don't believe everything you read on the Internet...

By the way, I think professional game developers use the FPU's SIMD
unit (MMX/SSE/3DNow) extensively for their math. These units do
support single-precision math natively, and you may in fact get a
factor 2 speedup if you use them (since they split their 64-bit
registers into two 32-bit registers for that job). However, .NET does
not support these units at all, so that won't help you either.
--
http://www.kynosarges.de
Nov 17 '05 #15
On Tue, 23 Aug 2005 06:22:46 +0100, Jon Skeet [C# MVP]
<sk***@pobox.co m> wrote:
In some 32-bit processors, I believe there is no microcode support for
performing some floating point operations in less than 80 bits. In
other words, everything's already being converted.


The FPU of the x86 line always performs calculations at 80 bit
precision, that's why you don't get any speedup for using float
instead of double (other than some memory transfer savings).

NB: In an earlier discussion I was notified that you can explicitly
put the FPU into 32-bit IEEE mode, but (a) I don't think it's actually
faster -- Intel just provides this feature to accomodate existing
programs; and (b) the .NET libraries don't use this mode anyway.

<ki******@hanma il.net> wrote:
2. There are two reasons why I want float based math
First, float precision math is 2x faster than double. It is said by
Atmapuri.


Tip: Don't believe everything you read on the Internet...

By the way, I think professional game developers use the FPU's SIMD
unit (MMX/SSE/3DNow) extensively for their math. These units do
support single-precision math natively, and you may in fact get a
factor 2 speedup if you use them (since they split their 64-bit
registers into two 32-bit registers for that job). However, .NET does
not support these units at all, so that won't help you either.
--
http://www.kynosarges.de
Nov 17 '05 #16
You are perfect man!

I don't think there can be better answer than yours.

Sincerely.

Nov 17 '05 #17
You are perfect man!

I don't think there can be better answer than yours.

Sincerely.

Nov 17 '05 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
7261
by: john smith | last post by:
Hi, I am trying to initialize a float in a class. For example: class ABC{ public:
5
2067
by: Jon Cosby | last post by:
I don't have the Math class available in CS. I have it in VB. Does anyone know why this would be? Jon
4
3657
by: Ryan Liu | last post by:
Is there a good reason that Decimal does not have Ceiling() method, only Math class has? Thanks!
10
8829
by: Ing. Carlos Villaseñor M. | last post by:
Hi everybody! I have developed in C# and got in a news group a math class that make matrix operations, eigenvals, eigenvecs, stat functions and much more, but now I trying to develop software in Visual Basic.NET and wondering if does exist something like that for Basic.NET. I appreciate some help Thank you
6
1859
by: Lee | last post by:
I'd like to implement a generic class that takes as its Type-parameter a numeric type (e.g. (U)Int16/32/64, float, double, decimal, etc.). The problem is that, having validated the Type-parameter, I cannot do any arithmetic operations (+, -, *, /) on variables of that type. I tried creating wrapper-classes for the numeric types I will support and tried to derive them from a custom interface that specified the above 4 operators -- but...
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10491
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10526
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9315
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7746
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5617
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4411
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3076
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.