QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
QgsMathUtils Class Reference

Contains utility functions for mathematical operations. More...

#include <qgsmathutils.h>

Static Public Member Functions

static Q_INVOKABLE void doubleToRational (double value, qlonglong &numerator, qlonglong &denominator, double tolerance=1.0e-9, int maxIterations=100)
 Converts a double value to a rational fraction.

Detailed Description

Contains utility functions for mathematical operations.

Since
QGIS 4.0

Definition at line 29 of file qgsmathutils.h.

Member Function Documentation

◆ doubleToRational()

void QgsMathUtils::doubleToRational ( double value,
qlonglong & numerator,
qlonglong & denominator,
double tolerance = 1.0e-9,
int maxIterations = 100 )
static

Converts a double value to a rational fraction.

Parameters
valuevalue to convert
numeratorcalculated numerator
denominatorcalculated denominator
tolerancedesired precision. The returned fraction will be at within this tolerance of the original value.
maxIterationsmaximum number of iterations. Higher values result in better approximations, but at the cost of additional computation.

Definition at line 23 of file qgsmathutils.cpp.


The documentation for this class was generated from the following files: