Help me!
I have this number 1726.16723958045672098127.
How Can I register in my db MySql.
Why is the number truncated?
riccardo.farabi
0
Newbie Poster
Recommended Answers
Jump to PostFinance? As in money? Then use Integer or Fixed Point types. No one in finance would select a floating point until it's about statistics.
Jump to PostTo illustrate in Python
>>> a = 15638.3627834621516782673486583 >>> b = 15638.3627834621516782672736583 >>> a - b 0.0 >>> a == b True >>> a 15638.362783462151
You can see that Python does not keep all the digits.
Jump to PostIn finance, or anywhere where precision is important, you use fixed point numbers (integer math), not floating point.
In finance moreover, typically (and this is an internationally recognised standard employed by banks) only the first 5 digits are considered significant.
Anything over that is irrelevant.
Jump to PostI have this number 1726.16723958045672098127.
How Can I register in my db MySql.
Why is the number truncated?should be a column type decimal, DECIMAL(24,20) would store the number you just mentioned without truncating.
24 - how many digits in the number
20 - how many digits are …
Jump to PostI'm not sure, but maybe this could help you?
All 21 Replies
rproffitt
2,580
"Nothing to see here."
Moderator
riccardo.farabi
0
Newbie Poster
rproffitt
2,580
"Nothing to see here."
Moderator
riccardo.farabi
0
Newbie Poster
Reverend Jim
4,780
Hi, I'm Jim, one of DaniWeb's moderators.
Moderator
Featured Poster
rproffitt
2,580
"Nothing to see here."
Moderator
riccardo.farabi
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
jwenting
1,889
duckman
Team Colleague
riccardo.farabi
0
Newbie Poster
Reverend Jim
4,780
Hi, I'm Jim, one of DaniWeb's moderators.
Moderator
Featured Poster
rproffitt
2,580
"Nothing to see here."
Moderator
Biiim
182
Junior Poster
riccardo.farabi
0
Newbie Poster
rproffitt
2,580
"Nothing to see here."
Moderator
pritaeas
commented:
Two thumbs up!
+17
Dani
4,084
The Queen of DaniWeb
Administrator
Featured Poster
Premium Member
Biiim
182
Junior Poster
riccardo.farabi
0
Newbie Poster
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
rproffitt
commented:
XY! 👍 Up!
+16
riccardo.farabi
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.