Skip to content

math.simplify with Fractions #2356

@chrisbansart

Description

@chrisbansart

Hi all mathjs contributors,
First of all thanks a lot for the incredible job you've achieved, math.js is really useful and impressive. I've figured out unexpected behaviour when using simplify with Fractions.
For instance:
math.simplify(math.Fraction('1/7').toString()) -> returns Object { value: 0 } => Seems to be the integer part
math.simplify(math.Fraction('9/7').toString()) -> returns Object { value: 285714 } => Seems to be the decimal part
Nevertheless
math.simplify(math.Fraction('5/4').toString()) -> returns a tree Object { implicit: false, isPercentage: false, op: "/", fn: "divide", args: (2) […] } with seems to contain the fraction.

Do you have any rational explanations ?. I use simplify with my programs that mix fractions with simplify and several times (1 out of 20 times) it occurs wrong results.
Kind regards
Chris

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions