Re: Converting floats to ints with intval
| From: | Fernando | Date: | Thu, 06 May 2010 14:06:54 +0000 |
| Subject: | Re: Converting floats to ints with intval | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-304958@lists.php.net to get a copy of this message | ||
I think Bob has a good idea here, split the string values and the concatenate them to make the whole value.
If the data is really stored in strings, you need to break it down into substrings around the decimal and then convert both sides into integers and combine them into an integer value. It is the conversion into float that introduces the error because of the imprecise representation of fractional decimal values in binary. Bob McConnell