473,320 Members | 1,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Float versus Double

I was just wondering if someone could explain the difference of these
Feb 19 '07 #1
3 62621
r035198x
13,262 8TB
I was just wondering if someone could explain the difference of these
For starters, double is bigger than float.
Double is also the default type for primitives with a decimal point. You can read about each of them in the tutorials and finish up the list of their differences on your own.
Feb 19 '07 #2
horace1
1,510 Expert 1GB
I was just wondering if someone could explain the difference of these
this is a good tutorial on the java primitive data types
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html

also
http://en.wikipedia.org/wiki/IEEE_754#Single-precision_32_bit

in practice you analyse the data you are using in the application and select the most appropriate data types. for example if the data inputted is accurate to 3 or 4 siginficant figures use a float (typical precision 6 or 7 significant figures) - no need for the greater precision of double and calculations in double take longer than float
Feb 19 '07 #3
dmjpro
2,476 2GB
thanx ....

good links
Feb 20 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Erik2000 | last post by:
If someone defines a float and double in C++, does that say anything about how many digits the number will hold at maximum and how many places there will be after the decimal point? Or is this...
14
by: wane | last post by:
Hello, I have heard that one should avoid using float and double in monetary calculation because of the lack of preciseness. What is a good alternative? Thanks
13
by: Michele Guidolin | last post by:
Hello to everybody. I'm doing some benchmark about a red black Gauss Seidel algorithm with 2 dimensional grid of different size and type, I have some strange result when I change the computation...
8
by: Quinn Kirsch | last post by:
Hi all, the following c# example baffles me. my understanding of the managed code of visual .net is that all casts like this would be safe, but this example seems to contradict this notion. if...
5
by: guy | last post by:
Can someone point me to page that gives a decision tree on deciding when to use float or double in a C# application including performance impacts of using one over the other. And when is decimal...
6
by: Steve | last post by:
Hi, I've developed a testing application that stores formatted results in a database. Recently it was requested that I add the ability to generate graphs from the raw, un formatted test results...
9
by: richard_lavoie | last post by:
Hi, I have something like this: vector<floatvec1; and I want to cast it, so I use vector vec2<double= static_cast< vector<double(vec1); I always become a error: syntax error before `>'...
116
by: Dilip | last post by:
Recently in our code, I ran into a situation where were stuffing a float inside a double. The precision was extended automatically because of that. To make a long story short, this caused...
15
by: Peng Yu | last post by:
Hi, Suppose T is 'float' or 'double'. T x; x < 10 * std::numeric_limits<T>::epsilon(); I can use the above comparison to test if 'x' is numerically zero. But I'm wondering what should be...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.