954,496 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

FLOATING POINT.......Please

Hi every one....


i have problem in c++ , i hope i find the solution for it :-| :-| :-| .

i want store number like 2.000000000002
12-13 digits after comma

it's important to me these digits.


i'm sorry if my english language is not good ,but this is all i can
forgive me guys.

ORA-MAN
Newbie Poster
6 posts since Aug 2005
Reputation Points: 10
Solved Threads: 0
 

double in C++ has a 64-bit precision. long double has the same I think, which leaves you with the opportunity to use either double, or if it's not good enough for you, you can use something like this: http://members.lycos.co.uk/keithmbriggs/doubledouble.html

freemind
Junior Poster in Training
62 posts since Jun 2005
Reputation Points: 10
Solved Threads: 1
 

I'd go with the doubledouble special datatype, since the regular double can only barely hold enough precision for your digits -- and if you do any interesting math with the numbers, the floating point error will be too much.

Rashakil Fol
Super Senior Demiposter
Team Colleague
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
 
Stoned_coder
Junior Poster
164 posts since Jul 2005
Reputation Points: 19
Solved Threads: 5
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You