//================================================================
// High Range Variable Precision Values
//
// AUTHOR:  Gabor Nagy
// DATE:    2014-Feb-26 23:20:43
//
// Copyright (C) 1996-2026 by Gabor Nagy. All rights reserved.
//================================================================

#ifndef _ELanguage_h
#define _ELanguage_h

#ifndef _ETypes_h
#include <ETypes.h>
#endif

#if defined (__cplusplus) && (!(defined (__CPLUSLIBS)))
extern "C" {
#endif

// Range bitmasks
//
#define hvPp08    0x20  // Ten on the power of   8 (e.g. 100000s of kilometers)
#define hvPp00    0x10  // Ten on the power of   0 (e.g. meters)
#define hvPn08    0x08  // Ten on the power of  -8 (e.g. nanometers)
#define hvPn16    0x04  // Ten on the power of -16 (e.g. attometers)


// 9397728

// E.g.  a light year is 1 light-year = 9460730472580800 metres (exactly)
// .Pp09= 94607304
// .Pp08= 72580800
// .Pm08= 0
// .Pm16= 0

typedef struct
{
	int		         Pp08,    // Ten on the power of   8 (e.g. 100000s of kilometers)
	               Pp00,    // Ten on the power of   0 (e.g. meters)
	               Pn08,    // Ten on the power of  -8 (e.g. nanometers)
	               Pn16;    // Ten on the power of -16 (e.g. attometers)
	float          fValue;
	double         dValue;
	unsigned char  Ranges;
} hrvpRec, *hrvp;



extern float   hrvpToFloat(const hrvp PHRVP, const unsigned char PRange);
extern double  hrvpToDouble(const hrvp PHRVP, const unsigned char PRange);
extern void    hrvpFromFloat(const float PF,  hrvp PHRVP, const unsigned char PRange);


#if defined (__cplusplus) && (!(defined (__CPLUSLIBS)))
}	// Close scope of 'extern "C"' declaration
#endif

#endif // _ELanguage_h
