Skip to content

math no longer supports logical expressions #4777

@mqudsi

Description

@mqudsi

I'm not sure if @krader1961's math implementation with muparser featured it, but the released version of fish that uses bc for math supports logical tests like math 1 == 1, which the new tinyexpr-based builtin doesn't.

Under fish 2.7.0, the following output is generated:

~> math 1 == 1; echo $status;
1
0
~> math 1 == 0; echo $status;
0
1

(I stumbled across an old script of mine which used math instead of test to evaluate the return value of an external command.)

Not sure what we want to do about this or how hard it would be to add in support, but in all cases we should make a decision either way whether this functionality is explicitly dropped or not. Naturally things like math 1 >= 0 never worked thanks to the redirection operator (though it would trivial to fix that if we end up choosing to keep logical tests in math functional).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions