the unit source is nowhere to be found and I can't find any documentation on the afore mentioned units, is the source kept in a secret place?
I am also intrigued about the unit ufloat128 but without any documentation or source it's a dead end
It is also in the sources distributed with Lazarus. C:\lazarus\fpc\3.2.2\source\rtl\inc\sfpux80.pp
ufloat128.pp is in the same folder.
As for using them:
program Project1;
uses
ufloatx80, sfpux80, SysUtils;
type
Extended = floatx80; // You do not need to map this / and if you do make sure it doesn't get mixed up
var
// a, b: floatx80; // without mapping
a, b: Extended;
begin
a := 1 / 3;
b := 1 / 7;
writeln(FloatToStrF(a, ffExponent, 21, 0));
writeln(FloatToStrF(b, ffExponent, 21, 0));
readln;
end.
Tested with fpc 3.2.3.
So, I did not build the files on their own. If you want to compile them from 3.2.2 you need to
- copy them to a new folder
- compile them
- find any units or inc files that are reported missing => and copy them too
- compile again
... repeat until success
EDIT: gonna be lots of work to get the inc files.... Better use FpcUpDeluxe and install 3.2.3 (if you are fine with using fixes branch)
--------------
EDIT
Actually FloatToStrF does not support them, as it is in the normal rtl.
So at that point the value would have been converted to double. And the output would be not exact.
You have to check in the 2 units what functions are supplied.
FloatToStrF has the operators, so you can do +.* and /
sfpux80 provides lots of functions, e.g. (and more):
function floatx80_round_to_int( a: floatx80 ): floatx80;
function floatx80_add( a: floatx80; b: floatx80 ): floatx80;
function floatx80_sub( a: floatx80; b: floatx80 ): floatx80;
function floatx80_mul( a: floatx80; b: floatx80 ): floatx80;
function floatx80_div( a: floatx80; b: floatx80 ): floatx80;
function floatx80_rem( a: floatx80; b: floatx80 ): floatx80;
function floatx80_sqrt( a: floatx80 ): floatx80;
function floatx80_eq( a: floatx80; b: floatx80 ): flag;
function floatx80_le( a: floatx80; b: floatx80 ): flag;
function floatx80_lt( a: floatx80; b: floatx80 ): flag;
function floatx80_eq_signaling( a: floatx80; b: floatx80 ): flag;
function floatx80_le_quiet( a: floatx80; b: floatx80 ): flag;
function floatx80_lt_quiet( a: floatx80; b: floatx80 ): flag;
function floatx80_is_signaling_nan( a: floatx80 ): flag;
function floatx80_is_nan(a : floatx80 ): flag;
function floatx80_to_int64( a: floatx80 ): int64;
function floatx80_to_int64_round_to_zero( a: floatx80 ): int64;