Skip to content

math.fraction() #2427

@fpiou

Description

@fpiou

I don't anderstand why the result is not the same.

f = math.fraction(4,5.1)
console.log(f.toFraction()) --> 2251799813685248/2871044762448691
f = math.fraction(4/5.1)
console.log(f.toFraction()) --> 40/51

Is it possible to add a constructeur of math.fraction(a,b) with a and b decimal ?

f = math.fraction(0)
f.n = 4
f.d = 5.1
console.log(f.toLatex()) // --> \dfrac{4}{5.1}
console.log(f.simplify().toLatex()) // --> \dfrac{40}{51}
console.log(f.toFraction()) // --> 4/5.1
console.log(f.simplify().toFraction()) // --> 40/51

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions