If the lhs or rhs are floats then the expression will be calculated with floats.
Given a sample.yml file of:
a: 3b: 4.5
then
yq eval '.a = .a - .b' sample.yml
will output
a: -1.5b: 4.5
If the lhs or rhs are floats then the expression will be calculated with floats.
Given a sample.yml file of:
a: 3b: 4.5
then
yq eval '.a = .a - .b' sample.yml
will output
a: -1.5b: 4.5
If both the lhs and rhs are ints then the expression will be calculated with ints.
Given a sample.yml file of:
a: 3b: 4
then
yq eval '.a = .a - .b' sample.yml
will output
a: -1b: 4
Given a sample.yml file of:
a: 3b: 5
then
yq eval '.[] -= 1' sample.yml
will output
a: 2b: 4