#ifndef _ExtendedReal_h_
#define _ExtendedReal_h_
/* ExtendedReal.h
*
* Copyright (C) 2025 David Weenink
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This code is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this work. If not, see .
*/
/*
We extend the set of real numbers into a non-Archimedian ordered field by adding infinitesimals.
A positive infinitesimal number eps is smaller than any positive real number.
The predicate a < b, where a and b are reals, is affected by adding infinitesimals in the following way:
The test might become a + eps**2**i) < b + eps**2**j (a**b**c is shorthand notation for power (a, power (b,c))).
Assume without loss of generality that 0 < i j).
Our simple implementation is the ExtendedReal with consists of the struct {double real; integer extension;}
'extension' represent the infinitesimal power (eps, power (2,extension)).
An ExtendedReal can be copied but should not be saved in a file.
*/
#include "Data.h"
#include "ExtendedReal_def.h"
template
autoVEC vector_to_VEC (vector v);
/*
Put the kth smallest element at position k
*/
template
void NUMselect (vector const& v, integer kth_asIfSorted);
structExtendedReal& NUMget_kth_inplace (vector const& v, integer kth_asIfSorted);
structExtendedReal& NUMget_kth (constvectorview const& v, integer kth_asIfSorted);
structExtendedReal& NUMquantile (constvectorview const& v, double factor);
structExtendedReal& NUMquantile_inplace (vector const& v, double factor);
#endif /* _ExtendedReal_h_ */