On Wed, Dec 21, 2011 at 12:24:09PM -0800, Michael R wrote:
> main() {
> ??? int x;
> ??? x
> = ( .00425 * 2 ) + .0025;
> ???
> printf ( "%24.24f\n", x - ( .00425 * 2) - .0025);
>
> }
>
> mikeraz@hive:~> gcc fp.c -o fp
> mikeraz@hive:~> ./fp
> -0.011001096345
Shouldn't that be som
On Wed, Dec 21, 2011 at 12:24:09PM -0800, Michael R wrote:
> I was reminded of something this morning.?? Perhaps you will enjoy
> the puzzle.
>
> ?mikeraz@hive:~> perl -e 'my $x = (.0425 * 2) + .0025;
> print $x - (.0425 * 2) - .0025, $/;'
> ?2.16840434497101e-18
In preparation for January's me
> "Tim" == Tim writes:
>> What languages use that, or something giving non-floating point
>> results these days?
Tim> I haven't had to use such things for a long time, but Scheme has
Tim> a data type for floating point and another data type for exact
Tim> numbers. [...]
Yeah, and Common Li
Tim wrote:
> On Wed, Dec 21, 2011 at 12:24:09PM -0800, Michael R
wrote:
>>
>>
>> I was reminded of something
this morning.?? Perhaps you will enjoy
>> the puzzle.
>
> That's floating point for you, and most traditional languages use
that
> by default. If you want exact calculations, you have to
On Wed, 21 Dec 2011, Richard C. Steffens wrote:
> Back in the late '70s and early '80s I wrote programs for small businesses
> with a version of Turbo Pascal that used binary coded decimal for math.
> What languages use that, or something giving non-floating point results
> these days?
Dick,
On 12/21/2011 01:33 PM, Tim wrote:
>> What languages use that, or something giving non-floating
>> point results these days?
> I haven't had to use such things for a long time, but Scheme has a
> data type for floating point and another data type for exact numbers.
> Python's documentation has a go
> What languages use that, or something giving non-floating
> point results these days?
I haven't had to use such things for a long time, but Scheme has a
data type for floating point and another data type for exact numbers.
Python's documentation has a good explanation of the issue and makes
th
On 12/21/2011 12:29 PM, Tim wrote:
> That's floating point for you, and most traditional languages use that
> by default. If you want exact calculations, you have to use a library
> specifically designed for them, or use a language which does exact
> calculations by default.
Back in the late '70
On Wed, Dec 21, 2011 at 12:24:09PM -0800, Michael R wrote:
>
>
> I was reminded of something this morning.?? Perhaps you will enjoy
> the puzzle.
>
> ?mikeraz@hive:~> perl -e 'my $x =
> (.0425 *
> 2) + .0025; print $x - (.0425 * 2) - .0025, $/;'
>
> ?2.16840434497101e-18
> ?mikeraz@hive:~>
>