473,725 Members | 2,243 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 102475
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
1749
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
3483
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
1935
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
13575
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
1261
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
7609
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
3191
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
1580
by: Joakim Hove | last post by:
Hello, consider a function: double some_func(double arg) { /* */ }
4
6226
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
3140
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
8889
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9401
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...
0
9257
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
9179
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
9116
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...
0
8099
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...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3228
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
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.