[development] Converting floats stored in scientific notation back to decimals
cog.rusty at gmail.com
Mon Nov 5 20:27:07 UTC 2007
On 11/5/07, Walt Daniels <wdlists at optonline.net> wrote:
> decimal numbers do not an exact binary representation (in general), e.g.
> 1/3, within the finite field width of computers. Any time you convert you
> have rounding issues which are messy at best. If your meaning of decimal
> numbers is really just dollars and cents (not internationalizable) with 2
> decimal places, then you should use integers (in cents) and then you just
> have a formating problem.
Since we are talking about updating/converting existing data, a
question is what people could have possibly stored there. Just money?
(and what currency?) Scientific measurements? Percentages and ratios?
(and what precision did they expect?) Hence my reservations about
storing fixed-point numbers.
> -----Original Message-----
> From: development-bounces at drupal.org [mailto:development-bounces at drupal.org]
> On Behalf Of Karen Stevenson
> Sent: Monday, November 05, 2007 1:59 PM
> To: development at drupal.org
> Subject: Re: [development] Converting floats stored in scientific notation
> back to decimals
> Are you going to use something big, such as decimal(64,32)? Or are you
> looking for a conversion which preserves the most significant digits up to
> some point? How many decimal digits do you have in mind?
> Perhaps I don't understand this correctly, but storing the values as
> decimals looks like trouble to me.
> Changing from a float column to a decimal column is an issue that was very
> important to a lot of people and I'm trying to make that happen. I am
> assuming that a decimal field with two decimals would be the type of column
> people would expect for the CCK decimal field, but I don't know for sure
> what size or precision would be best.
> Anyway, what I'm really trying to do is find a volunteer familiar with and
> interested in getting a real decimal field in CCK who can figure out what is
> needed and create a patch for this. I'm trying to get the D6 port done and
> don't have time to do it. If I do spend time doing it, it will delay getting
> CCK ported to 6x.
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.15.22/1111 - Release Date: 11/5/2007
> 4:36 AM
More information about the development