View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0038715 | FPC | Compiler | public | 2021-04-07 17:31 | 2021-04-09 10:46 |
Reporter | Ondrej Pokorny | Assigned To | Florian | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | feedback | Resolution | open | ||
Platform | i386-win32 | OS | Windows | ||
Product Version | 3.3.1 | ||||
Summary | 0038715: Wrong result from an explicit cast Double() | ||||
Description | When I use an explicit cast to Double, I get a wrong result. | ||||
Steps To Reproduce | Execute procedure Test_OtherUnit(const aValue: Currency); begin Writeln('Test_OtherUnit'); Writeln('aValue: ', aValue); // writes correct value Writeln('Double(): ', Double(aValue)); // writes incorrect value end; from a different unit. The cast returns a wrong value. Full project is attached. | ||||
Additional Information | Interestingly, if the same code is called from the same unit, the cast works fine. I also tested ARM Linux and there it seems to work just fine. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | |||||
FPCOldBugId | |||||
FPCTarget | - | ||||
Attached Files |
|
|
|
|
It is not a regression - I just tested FPC 2.6.4 and it has the bug as well. |
|
It is not bound only to Currency, also Int64 returns wrong results: procedure Test_OtherUnit(const aValue: Int64); begin Writeln('Test_OtherUnit'); Writeln('aValue: ', aValue); // writes correct value Writeln('Double(): ', Double(aValue)); // writes incorrect value end; |
|
I think it depends on the language mode (delphi and non-delphi, to be honest I do not remember which way around), if an explicit type cast is really a cast or a conversion. |
|
Can you please test if you have different language modes active? |
Date Modified | Username | Field | Change |
---|---|---|---|
2021-04-07 17:31 | Ondrej Pokorny | New Issue | |
2021-04-07 17:31 | Ondrej Pokorny | File Added: RoundTo.zip | |
2021-04-07 17:39 | Ondrej Pokorny | Summary | Regression in explicit cast Double(Currency) => Wrong result from an explicit cast Double(Currency) |
2021-04-07 17:39 | Ondrej Pokorny | Description Updated | View Revisions |
2021-04-07 17:39 | Ondrej Pokorny | Steps to Reproduce Updated | View Revisions |
2021-04-07 17:39 | Ondrej Pokorny | Additional Information Updated | View Revisions |
2021-04-07 17:39 | Ondrej Pokorny | FPCTarget | => - |
2021-04-07 17:41 | Ondrej Pokorny | Note Added: 0130156 | |
2021-04-07 17:47 | Ondrej Pokorny | Summary | Wrong result from an explicit cast Double(Currency) => Wrong result from an explicit cast Double() |
2021-04-07 17:47 | Ondrej Pokorny | Description Updated | View Revisions |
2021-04-07 17:47 | Ondrej Pokorny | Note Added: 0130157 | |
2021-04-08 16:26 | Florian | Note Added: 0130176 | |
2021-04-09 10:46 | Florian | Assigned To | => Florian |
2021-04-09 10:46 | Florian | Status | new => feedback |
2021-04-09 10:46 | Florian | Note Added: 0130190 |