Pascal compiler for PIC32. Are trying to use pi with extended format, but it comes out as a 24bit value.
program exper;
var pie : extended;
uta, utb, utc : array[23] of char;
begin
pie := pi;
ExtendedToStr(pie, uta); {3.141592741012573 this is a 24 bit value}
pie := 3.1415926535897932384626433832795; {good value}
ExtendedToStr(pie, utb); {3.141592741012573 still a 24 bit value}
pie := pie - 0.00000008742278; {difference from good value}
pie := pie - 0.0000000000000035; {needed to get lsb to 0x18 }
ExtendedToStr(pie, utc); {3.141592653589793 }
end. { Main program }
Is seems that constants are trunkated to 24bit real before they are put into code.
Filip Jankovic
Comments
ken.gus@telia.com
Pascal compiler for PIC32. Are trying to use pi with extended format, but it comes out as a 24bit value.
program exper;
var pie : extended;
uta, utb, utc : array[23] of char;
begin
pie := pi;
ExtendedToStr(pie, uta); {3.141592741012573 this is a 24 bit value}
pie := 3.1415926535897932384626433832795; {good value}
ExtendedToStr(pie, utb); {3.141592741012573 still a 24 bit value}
pie := pie - 0.00000008742278; {difference from good value}
pie := pie - 0.0000000000000035; {needed to get lsb to 0x18 }
ExtendedToStr(pie, utc); {3.141592653589793 }
end. { Main program }
Is seems that constants are trunkated to 24bit real before they are put into code.
Kenneth43