Differences in results when using the same function in CTFE and Runtime
Abdulhaq
alynch4048 at gmail.com
Thu Aug 15 16:21:35 UTC 2024
On Thursday, 15 August 2024 at 09:13:31 UTC, Carsten Schlote
wrote:
> On Tuesday, 13 August 2024 at 07:56:34 UTC, Abdulhaq wrote:
>> One little piece of anecdata, when working with python I saw
>> differing results in the 17th d.p. when running the exact same
>> calculation in the same python session. The reason turned out
>> to be which registers were being used each time, which could
>> vary. This is not considered to be a bug.
>
> I would consider it a bug.
>
I'd say that whether it's a bug or not comes down to the
definition of "bug", and I don't think a discussion of that is
useful, and also it's subjective and reasonable people can differ
on it.
But I would say that, in my python example, both answers were
wrong, in the sense that they were not exactly right (and can't
be), but they were both wrong in a different way.
In your example I'd ask you to consider this: all the images you
created, except the trivial ones, were wrong, in the sense that
some of the calculations were inexact and some of them had
sufficient error to change the color of the pixel. It's just that
the CTFE image was wrong in a different way to the non-CTFE
image. Why do you want to reproduce the errors?
In general floating point calculations are inexact, and we
shouldn't (generalising here) expect to get the same error across
different platforms.
In this specific case you could argue that it's the "same
platform", I get that.
More information about the Digitalmars-d
mailing list