Rational Class Reference

`#include <Rational.hpp>`

## Public Member Functions | |

Rational (std::int32_t numerator=0, std::int32_t denominator=1) noexcept | |

std::int32_t | numerator () const noexcept |

std::int32_t | denominator () const noexcept |

double | value () const noexcept |

Rational | inverse () const noexcept |

Rational & | operator+= (const Rational &other) noexcept |

Rational & | operator-= (const Rational &other) noexcept |

Rational & | operator*= (const Rational &other) noexcept |

Rational & | operator/= (const Rational &other) noexcept |

void | pup (PUP::er &p) noexcept |

## Friends | |

Rational | operator- (Rational r) noexcept |

A rational number

This serves as a faster replacement for `boost::rational<std::int32_t>`

. As of Boost 1.65.0, arithmetic operators average about twice as fast, and ordering operators are about eight times as fast.

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

- src/Utilities/Rational.hpp
- src/Utilities/Rational.cpp

© Copyright 2017 - 2020 SXS Collaboration, Distributed under the MIT License