473,698 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

double or float

Hi,

just a general question.
Which data type is more precise for large values:
float or double?

Thank you.
Chris
Sep 6 '05
11 102469
Yeah its true
sizeof(float) <= sizeof(double) <= sizeof(long double)

- but can you give me an example on a platform/compiler with
float = double ?

And if you can then still nothing is lost by writing double instead of
float.

Sep 11 '05 #11
tmartsum wrote:

float is normally faster and normally half the size.
I have had sizeproblems with double in a homemade racetrayer
where I had a figure with about 20 millon triangles ...


Now *that* is a real, real, real good reason.
And I guess the problem of 'surface acne' kept you busy
for quite a while.

('Surface acne' is the name for the arithmetic problem that your
formulas come up with an intersection, when there really is none.
Such as a shadow ray emitting from a surface with the surface itself.
The ray tracer erronously sets this pixel into shadow giving the whole
surface a speckled appearance)

--
Karl Heinz Buchegger
kb******@gascad .at
Sep 12 '05 #12

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

Similar topics

4
1747
by: Justin Sane | last post by:
I have created a liquid layout with 3 columns, the left and right cols being floated, and inside the middle column, I have a list of items that are floated to the left so that I have a pure liquid layout. Problem is: all that comes after the list of items is floated to left too: http://www.auriance.com/docs/test/index.html The word "Article" is on the same level of the last image at times, depending on the width of the window. Now, if...
2
3481
by: Rikkert | last post by:
I am trying to make an Edit control that accepts only numbers and one point (i.e. only accepting input of type 'double' or 'float'). Can this be done without using MFC? The standard options for the Edit control seem to be either accepting all character input, or only integer number input, which doesn't quite cut it... Any tips are appreciated!
3
1933
by: Alan | last post by:
hi, are there any functions that can change double and float to string ? and is it possible to change the double/float to string which only contains decimal format instead of exponent expression? thx
1
13569
by: Jan Agermose | last post by:
Im writing a small test app that reads stringvalues, parses them to doubles and inserts the doubles into a mssql database. But the values inserted are not the same as the original string values? I tried paring the values using one of the two linies: double vekselkurs = double.Parse(node.Attributes.Value.Replace(".", ",")); //double vekselkurs = double.Parse(node.Attributes.Value, new
0
1257
by: Andreas Busse | last post by:
Hello everybody, how can I assign one of the above values to a float or double? regards, Andreas
6
7607
by: karthi | last post by:
hi, I need user defined function that converts string to float in c. since the library function atof and strtod occupies large space in my processor memory I can't use it in my code. regards, Karthi
2
3189
by: nemesisneo | last post by:
Please find details of small program written by me: ( UNIX NCR MP-RAS, NCR C/C++ Complier, Double is 8 bytes (Just in case)) double j; j = 3003486271; printf("\n double - > %17.14E ",j);
6
1578
by: Joakim Hove | last post by:
Hello, consider a function: double some_func(double arg) { /* */ }
4
6220
by: siryuhan | last post by:
I am trying to apply bitwise operations on float, double, and long double values. I do not believe this is possible natively, so I created a wrapper class to construct a double value given two integers, similar to the bit representation of floating point numbers. However, this is tedious and the decoding/encoding process is not efficient. Is there a portable way to apply AND, OR, XOR, >>, and << to doubles? Thanks in advance.
5
3139
by: habibo | last post by:
Hi frends double float data tybe in c# hase the folling rang 5*10^(-324) to (1.7)*10^308 yet it is mentioned in the storage size to be 64 bit how it comes the mentioned range need storag size nearly 1024 bits please to clearify such contraduction as it seem to me and what is the maximum integer size which we can handle in c# , or any other languge becuase i need a languge to handle 200 digit integer thank you in advance
0
8603
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
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8895
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
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6518
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
5860
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
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2329
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
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.