Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I128(-42) instead of I64(-42) #54

Open
azemlya opened this issue Sep 27, 2024 · 3 comments
Open

I128(-42) instead of I64(-42) #54

azemlya opened this issue Sep 27, 2024 · 3 comments

Comments

@azemlya
Copy link

azemlya commented Sep 27, 2024

Another thing I don't understand:

{% set m = {
    "key1": 42,
    "key2": -42,
    "key3": 42.424242,
    "key4": -42.424242,
} %}

In the debug mode, I take a look and see I128(-42).

Map(String("key1"): I64(42), String("key2"): I128(-42), String("key3"): F64(42.424242), String("key4"): F64(-42.424242))

Why? What is the reason for this?

@Keats
Copy link
Owner

Keats commented Sep 27, 2024

It's using i128 internally for all operations on integers, and -42 is one. Floats are always f64 so it's not changing anything for them

@azemlya
Copy link
Author

azemlya commented Sep 28, 2024

I made my own filter that generates TOML data. But, TOML format does not support I128. An error occurs when integers are negative.

@Keats
Copy link
Owner

Keats commented Sep 29, 2024

You can probably cast them to i64. Having a single type of integers for numbers is easier internally for operation results. I might need to add some impl for filters so it does the conversion automatically though, I can't remember if it's already in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants