ptkwt
2/10/2005 9:56:00 AM
In article <20050210132324.ABE9B400.ocean@m2.ccsnet.ne.jp>,
H.Yamamoto <ocean@m2.ccsnet.ne.jp> wrote:
>
>ptkwt@aracnet.com (Phil Tomson) wrote:
>(2005/02/09 23:00)
>
>>To see the problem, I suspect you'll need more than the FixedPt class.
>>You'll probably also need the entire application. It's a support vector
>>machine implementation (kind of like a neural network). I could send it to
>>you in a tar file if you wish.
>
>Sorry, I don't have G4 machine (and none of mac machines), so I cannot reproduce
>problem from entire application. I thought if FixedPt is simple enough, I could
>guess problem from its source code.
>
FixedPt is only part of the system. The FixedPt class allows simulation
of fixed point arithmetic. If you define:
fp = FixedPt.new(2.5,4,2)
You end up with:
fp.raw #=> 10 the raw value
which is 1010 in binary. considering that the binary point is at bit 2,
you have:
10.10 in binary, which is 2.5 in decimal.
># I suspected lack of precision at first. Conversion String <=> Float may not be
># acculate enough in current ruby implementation. [ruby-talk:69518]
>
I do some String -> Float conversion when I read in values from a file
(using scanf) but after that there are no such conversions. If that were
the problem, I suspect I would have seen it much earlier when I was doing
full floating point calculations. I suspect a difference in the hardware since
it runs fine on a Pentium IV machine, but fails on G4. It's not totally
unexpected since I'm dealing with some very small values in some cases,
and these very small values get summed together many times to determine an
outcome - so even small errors can be magnified.
Phil