Skip to content

why dividing integers result becomes float ? #1687

Answered by mikefarah
shakibamoshiri asked this question in Q&A
Discussion options

You must be logged in to vote

Yeah I think you're right - the divide is a little naive and just assumes a float. Feel free to raise a bug.

As a workaround you can manually override the tag to be an int:

./yq -n '.result = (20 / 10) | .result tag= "!!int"'
result: 2

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by shakibamoshiri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants