Macaulay2 Engine
Loading...
Searching...
No Matches
ARingRRRTest.cpp File Reference

gtest coverage for the MPFR-backed M2::ARingRRR arbitrary-precision real aring. More...

#include <cstdio>
#include <string>
#include <iostream>
#include <sstream>
#include <memory>
#include <gtest/gtest.h>
#include <mpfr.h>
#include "aring-RRR.hpp"
#include "ARingTest.hpp"

Go to the source code of this file.

Functions

bool almostEqual (const M2::ARingRRR &R, int nbits, const M2::ARingRRR::ElementType &a, const M2::ARingRRR::ElementType &b)
template<>
void getElement< M2::ARingRRR > (const M2::ARingRRR &R, int index, M2::ARingRRR::ElementType &result)
 TEST (ARingRRR, create)
void testRingNegateRRR (const M2::ARingRRR &R, int ntrials)
 TEST (ARingRRR, negate)
 TEST (ARingRRR, add)
 TEST (ARingRRR, subtract)
 TEST (ARingRRR, multDivide)
 TEST (ARingRRR, axioms)
 TEST (ARingRRR, power_and_invert)

Detailed Description

gtest coverage for the MPFR-backed M2::ARingRRR arbitrary-precision real aring.

Note
AI-generated documentation. Verify against the source before relying on it.

Drives M2::ARingRRR through the shared ARingTest.hpp harness with a precision-aware almostEqual that builds the epsilon directly as an mpfr_t via mpfr_set_ui_2exp(epsilon, 1, -nbits) — so the tolerance scales with the ring's get_precision() rather than being pinned to 53 bits. getElement<M2::ARingRRR> and testSomeMore then exercise arithmetic, equality, inverses, and stream round-trips at the full configured precision; the suite also serves as the cross-backend agreement check that the 53-bit ARingRR stays within 2^-50 of an ARingRRR configured at 53 bits.

Sibling files ARingRRTest.cpp, ARingRRiTest.cpp, ARingCCTest.cpp, and ARingCCCTest.cpp (covered by the same file-aring-real-complex-tests markdown) follow the same template against double, MPFI intervals, and MPC complex backends. Each carries its own almostEqual scaled to the underlying representation.

See also
ARingTest.hpp
aring-RRR.hpp
ARingRRTest.cpp
ARingCCCTest.cpp

Definition in file ARingRRRTest.cpp.