[fpc-pascal] C# translatation

Sven Barth pascaldragon at googlemail.com
Sun Jan 8 13:57:47 CET 2017


On 08.01.2017 13:01, Ryan Joseph wrote:
> 
>> On Jan 8, 2017, at 6:55 PM, Ryan Joseph <ryan at thealchemistguild.com> wrote:
>>
>> why am I getting this error? Operator is not overloaded: "Double" mod “LongInt”. Mod can’t be used with double and integers like in C?
> 
> 
> Sorry for the repeat. Same error here but "Operator is not overloaded: "Double" and “Byte””. This worked in c as "xi = x & 255"
> 
> x: double;
> xi: integer;
> 
> 	xi := x and 255;

If you look at the C# code again you'll see this:

=== code begin ===

xi = (int)x & 255;

=== code end ===

Including the information contained in the comment on the right I'd say
it should be this:

=== code begin ===

xi := Floor(x) and 255;

=== code end ===

(Floor() is from unit Math)

Regards,
Sven



More information about the fpc-pascal mailing list