On Tue, 19 Jul 2016, Luiz Americo Pereira Camara wrote:

2016-07-19 5:47 GMT-03:00 Michael Van Canneyt <[email protected]>:



On Tue, 19 Jul 2016, Dimitrios Chr. Ioannidis wrote:

    Exception class:   EAssertionFailedError
    Exception message: "Correct extended value" expected: <5,67> but was:
<6>
        at   $0043241F  TTESTJSONDESTREAMER__TESTFLOAT4,  line 374 of
testjsonrtti.pp


I am aware of this.

However, this is only on i386, on 64-bit the code runs fine.
I have no idea why, the code should be CPU agnostic.

I have not yet had the opportunity to debug it on a i386 machine.


I just looked at it in this weekend.

After doing some tests and reading the docs i realized that is not a bug in
fpjsonrtti, nor a bug at all.

First write directly 4.56 to the property (of comp type). Reading it
directly gives a rounded value (5)

Than i read the docs:
http://www.freepascal.org/docs-html/ref/refsu6.html
"The Comp type is, in effect, a 64-bit integer and is not available on all
target platforms. To get more information on the supported types for each
platform, refer to the Programmer’s Guide. "

http://www.freepascal.org/docs-html/prog/progsu160.html#x204-2130008.2.5
"Comp

For Intel 80x86 processors, the comp type contains a 63-bit integral value,
and a sign bit (in the MSB position). The comp type uses 8 bytes of storage
space.

On other processors, the comp type is not supported.
"

It works in 64bit cpu because is testing other code:

{$ifdef CPUX86_64}
   AssertProp('ExtendedProp',TJSONFloat(5));
 {$else}
   AssertProp('ExtendedProp',4.56);
 {$endif}

Haha... I was thrown off by the ExtendedProp in the error reports.
That should be CompProp obviously. I will adapt the test code accordingly.

Many many thanks for spotting this !!

Michael.
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to