hello, i want programm the silab I570 and need
the frac() and trunc() as in delphi to split a real into the integer and rest-part.
Doe any how does it goes in micropascal ?
greatings michael
trunc() and frac() in pascal ?
hello i think this should be go ?
i tested this
RFREQ:=123.456;
RFREQ_int :=integer(RFREQ); // integerpart
RFREQ_frac:=integer((RFREQ-RFREQ_int)); / rest
is this right ?
RFREQ:=123.456;
RFREQ_int :=integer(RFREQ); // integerpart
RFREQ_frac:=integer((RFREQ-RFREQ_int)); / rest
is this right ?
Re: trunc() and frac() in pascal ?
Hi, Trunc and frac do not exist (yet) in mikroPascal, see http://www.mikroe.com/forum/viewtopic.php?t=19177.sharpals wrote:hello, i want programm the silab I570 and need
the frac() and trunc() as in delphi to split a real into the integer and rest-part.
Doe any how does it goes in micropascal ?
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
Re: hello i think this should be go ?
Yes, its right. The floating-point math in mP does no rounding, so typecasting to integer is equivalent to truncation. You may also use the modf function to get both the integer and fractional parts.sharpals wrote: RFREQ:=123.456;
RFREQ_int :=integer(RFREQ); // integerpart
RFREQ_frac:=integer((RFREQ-RFREQ_int)); / rest
is this right ?