Skip to content

Decimal to rational number convertion #2

Description

@varsill

The conversion between decimal numbers (used in _createRational1() ), stored as floating point variables and rational numbers has been implemented in the easiest way possible - the numerator is get by multiplying the float number by some fixed number with value 10^n while the denominator is simplu 10^n. That may lead to errors while converting big numbers (variables can easly overflow) as well as might not be accurate - we want to be able to convert 0.33333333333 to 1/3. There is a need to implement the conversion based on the theory of continued fractions.

Function to be rewritten: void approximate(double x, int* nominator, int* denominator)

https://stackoverflow.com/questions/95727/how-to-convert-floats-to-human-readable-fractions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions