[fpc-devel] Floating point precision
Colin Western
mftq75 at dsl.pipex.com
Wed Apr 11 23:06:34 CEST 2007
Jonas Maebe wrote:
>
> On 09 Apr 2007, at 22:38, Colin Western wrote:
>
>
>> Having said that, for numerical programming if double is wanted, the
>> evaluation as double in the absence of specific precision information
>> is actually desirable, and avoids some hard to find errors. Values
>> like Sqrt(2) are common, which I should presumably write as
>> Sqrt(Double(2)) to be sure I don't loose precision. It came up because
>> my application (which requires double rather than single accuracy) was
>> giving slightly different results for different architectures. I have
>> now gone through and fixed the differences I can find, and the results
>> are now the same, but it is difficult to be sure I have caught all the
>> problem areas.
>>
>> Is there some way of optionally making double the default for
>> constants (rather than single) as a way of avoiding these errors?
>
> Please file a bug report/feature request for this. The current behaviour
> is needed for Delphi compatibility, and for avoiding wrong precision
> loss warnings like in
> http://www.freepascal.org/mantis/view.php?id=7179
>
I have filed the feature request at
<http://www.freepascal.org/mantis/view.php?id=8678>
Having looked at 7179 would the behavior I want be obtained if we had
the option just to treat 1.0 as Double rather than Single?
Colin
More information about the fpc-devel
mailing list