Skip to content

B: Real

Havik2 edited this page Feb 24, 2018 · 3 revisions

Overview

The Real class identifies values as real, which encompasses the Rational and Integer classes. Includes comparison operators and arithmetic operations for the real numbers.

Structure

Holds a single double with the name value.

Behavior

Has the arithmetic operations used for real numbers +, -, *, /, %. Also has the comparison operations ==, >, <, >=, <=, !=. The code also does not allow the user to set the value of value.

Example

#include <iostream>
#include "shaka_scheme/system/base/Real.hpp"
#include "shaka_scheme/system/base/Rational.hpp"
#include "shaka_scheme/system/base/Integer.hpp"
int main() {
std::cout<<"Real Number"<<std::endl;
shaka::Real r(24.5678);
std::cout<<r.get_value()<<std::endl;
}