Modifica 95/34
Aggiunto il metodo trail che toglie gli zeri non significativi git-svn-id: svn://10.65.10.50/trunk@1859 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
0eb80acad6
commit
7f82dc354e
@ -30,10 +30,15 @@ real::real (double a)
|
||||
{
|
||||
dftodr (ptr (), a, 9); // Round the number (1.0 is NOT 0.999999999)
|
||||
|
||||
deltrz (ptr (), ptr ()); // Delete Trailing zeroes
|
||||
trail( ); // Delete Trailing zeroes
|
||||
|
||||
}
|
||||
|
||||
void real::trail( )
|
||||
{
|
||||
deltrz (ptr (), ptr () ); // Delete Trailing zeroes
|
||||
}
|
||||
|
||||
char *real::eng2ita (char *s)
|
||||
{
|
||||
if (s)
|
||||
@ -147,6 +152,7 @@ real & real::operator -= (const real & b)
|
||||
real & real::operator *= (const real & b)
|
||||
{
|
||||
dmul (ptr (), ptr (), b.ptr ());
|
||||
trail( );
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -161,7 +167,7 @@ real & real::operator /= (const real & b)
|
||||
error_box ("Division error: %s", __string);
|
||||
}
|
||||
#endif
|
||||
|
||||
trail( );
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -225,7 +231,7 @@ char *real::string (
|
||||
if (dec != UNDEFINED)
|
||||
__tmp_real.round (dec);
|
||||
else
|
||||
deltrz (__tmp_real.ptr (), __tmp_real.ptr ());
|
||||
__tmp_real.trail();
|
||||
|
||||
dtoa (__string, __tmp_real.ptr ());
|
||||
int lun = strlen (__string);
|
||||
@ -606,6 +612,7 @@ real operator *(
|
||||
|
||||
{
|
||||
dmul (__tmp_real.ptr (), a.ptr (), b.ptr ());
|
||||
__tmp_real.trail( );
|
||||
return __tmp_real;
|
||||
}
|
||||
|
||||
@ -613,6 +620,7 @@ real operator *(double a, const real & b)
|
||||
|
||||
{
|
||||
muldfd (__tmp_real.ptr (), b.ptr (), a);
|
||||
__tmp_real.trail( );
|
||||
return __tmp_real;
|
||||
}
|
||||
|
||||
@ -620,6 +628,7 @@ real operator *(const real & a, double b)
|
||||
|
||||
{
|
||||
muldfd (__tmp_real.ptr (), a.ptr (), b);
|
||||
__tmp_real.trail( );
|
||||
return __tmp_real;
|
||||
}
|
||||
|
||||
@ -636,6 +645,7 @@ real operator / (
|
||||
// @syntax operator /(const real &a, double b);
|
||||
{
|
||||
ddiv (__tmp_real.ptr (), a.ptr (), b.ptr ());
|
||||
__tmp_real.trail( );
|
||||
return __tmp_real;
|
||||
}
|
||||
|
||||
@ -644,6 +654,7 @@ real operator / (double a, const real & b)
|
||||
{
|
||||
__tmp_real = a;
|
||||
ddiv (__tmp_real.ptr (), __tmp_real.ptr (), b.ptr ());
|
||||
__tmp_real.trail( );
|
||||
return __tmp_real;
|
||||
}
|
||||
|
||||
@ -652,6 +663,7 @@ real operator / (const real & a, double b)
|
||||
{
|
||||
__tmp_real = b;
|
||||
ddiv (__tmp_real.ptr (), a.ptr (), __tmp_real.ptr ());
|
||||
__tmp_real.trail( );
|
||||
return __tmp_real;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,11 @@ protected:
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
|
||||
|
||||
|
||||
// @cmember Rimuove gli zeri prima della virgola, aggiustando la precisione
|
||||
void trail( );
|
||||
|
||||
// @cmember Trasforma un numero dal formato inglese (decimali con punto) in
|
||||
// formato italiano (decimali con virgola)
|
||||
static char* eng2ita(char* s);
|
||||
|
Loading…
x
Reference in New Issue
Block a user