Setting Double.Frac loses sign information
Original Reporter info from Mantis: zoran
-
Reporter name: Zoran Vučenović
Original Reporter info from Mantis: zoran
- Reporter name: Zoran Vučenović
Description:
Setting the Frac helper property of Double clears sign bit.
The bug is actually in TDoubleRec.SetFrac procedure.
The bug does not appear with Single type, only with Double (TSingleRec.SetFrac is implemented correctly).
I am attaching the patch (it is one line only).
Steps to reproduce:
program Project1;
{$mode objfpc}{$H+}
uses
SysUtils;
var
D: Double;
Q: QWord;
begin
D := -1;
WriteLn(D);
Q := D.Frac;
D.Frac := Q; // the sign is lost!
WriteLn(D);
ReadLn;
end.
Mantis conversion info:
- Mantis ID: 38202
- Build: 47749
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 47765 (#53a4e6c5)