RRatioFlint
AI coding workspace

Canonical rational fractions

RatioFlint supports project-based AI conversations about rational arithmetic code. Review normalization rules, inspect suggested changes and run the denominator and operand checks in your own environment.

● ● ●RatioFlint●
A concrete starting point · Canonical rational fractions ×
from math import gcd

def reduce_fraction(numerator, denominator):
    if any(type(v) is not int for v in (numerator, denominator)):
        raise ValueError("integer.required")
    if denominator == 0:
        raise ValueError("denominator.zero")
    if denominator < 0:
        numerator, denominator = -numerator, -denominator
    divisor = gcd(numerator, denominator)
    return numerator // divisor, denominator // divisor
✳Reduce a fraction of two integers to a positive denominator and coprime terms.
✓ ChangesReview before applying ↗
Illustrative workspace
01

Connection

Base URL, credentials and a reachable server.

02

Project

Check a negative denominator and a zero numerator, rejecting a zero denominator and non-integer operands before reduction.

03

Review before applying

Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.

Workflows

Canonical rational fractions

Workflows ↗
A concrete starting point
from math import gcd

def reduce_fraction(numerator, denominator):
    if any(type(v) is not int for v in (numerator, denominator)):
        raise ValueError("integer.required")
    if denominator == 0:
        raise ValueError("denominator.zero")
    if denominator < 0:
        numerator, denominator = -numerator, -denominator
    divisor = gcd(numerator, denominator)
    return numerator // divisor, denominator // divisor
AI coding workspace

Your next change starts here.

Get the Windows app ↗