Function Math Arithmetic Class

RationalToFractionString

"Rational Number To Fraction String" Converts vRational to X+Y/Z (where X, Y, and X are all integers) then returns that algebraic expression as a string.

Signature (Visual Basic / VBA)

Public Function RationalToFractionString( _
    ByVal vRational As Variant _
    ) As Variant

Code Example

    RationalToFractionString(2.4) = "2+2/5"
    RationalToFractionString(43.75) = "43+3/4"
    RationalToFractionString(-43.75) = "-43-3/4"
    RationalToFractionString(-43) = "-43"

Parameters

Parameter Description
vRational The number which is separated into its integer, fractional dividend, and fractional divisor parts. Function returns Null if vRational is Null or cannot be fixed up to a number. Note: When vRational is positive, the fraction will be of the form "X+Y/Z" and when vRational negative, the fraction will be of the form "-X-Y/Z". (When vRational is negative, the dividend will always be negative and the divisor will always be positive.)