Skip to content

[Bug]: Incorrect cast from FIXED variable to LONG #1039

@oskostenko

Description

@oskostenko

Contact Details

No response

Compiler version

v1.18.5

What happened?

When a fixed variable is converted to long by using int or cast, the result is incorrect.

dim var_fix as fixed = 1.5

' These statements print incorrect result "-2147483647":
print int(var_fix)
print cast(long, var_fix)

' These, however, give the correct result "1":
print cast(integer, var_fix)
print cast(byte, var_fix)

' Also correct when using a constant, prints the correct result "1":
const const_fix as fixed = 1.5
print int(const_fix)
print cast(long, const_fix)

Error and Warning messages

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions