/*
 * The following tests assume the default value for fpprec; make sure
 * it's the default
*/
(reset(fpprec), 0);
0;

unit_in_last_place(0) ;
1 ;

unit_in_last_place(-534234) ;
1 ;

unit_in_last_place(2/3) ;
0 ;

unit_in_last_place(0.0b0) ;
0.0b0 ;

unit_in_last_place(0.0) - least_positive_float ;
0.0;

unit_in_last_place(2*unit_in_last_place(0.0)) - least_positive_float ;
0.0;

unit_in_last_place(unit_in_last_place(0.0)*(2^53+1)) - least_positive_float ;
0.0;

unit_in_last_place(unit_in_last_place(0.0)*(2^53+2)) - 2*least_positive_float ;
0.0;

2*unit_in_last_place(float((0+2^52)/2^1073)) - unit_in_last_place(float((1+2^52)/2^1073)) ;
0.0 ;

unit_in_last_place(1.0)-unit_in_last_place(.9999) ;
0.0 ;

unit_in_last_place(1.0001)-2*unit_in_last_place(1.0000) ;
0.0 ;

unit_in_last_place(1.0b0)-unit_in_last_place(.9999b0) ;
0.0b0 ;

unit_in_last_place(1.0001b0)-2*unit_in_last_place(1.0000b0) ;
0.0b0 ;

2.0^1023*(2.0-unit_in_last_place(2.0)) - most_positive_float ;
0.0 ;

unit_in_last_place(-1.0)-unit_in_last_place(1.0) ;
0.0 ;

is_power_of_two(0) ;
false ;

is_power_of_two(1) ;
true ;

is_power_of_two(1048576) ;
true ;

is_power_of_two(1048575) ;
false ;

is_power_of_two(1048577) ;
false ;

is_power_of_two(1/256) ;
true ;

is_power_of_two(1/384) ;
false ;

is_power_of_two(0.0e0) ;
false ;

is_power_of_two(1.0e0) ;
true ;

is_power_of_two(1048576.0e0) ;
true ;

is_power_of_two(1048575.0e0) ;
false ;

is_power_of_two(1048577.0e0) ;
false ;

is_power_of_two(1/256.0e0) ;
true ;

is_power_of_two(0.0b0) ;
false ;

is_power_of_two(1.0b0) ;
true ;

is_power_of_two(1048576.0b0) ;
true ;

is_power_of_two(1048575.0b0) ;
false ;

is_power_of_two(1048577.0b0) ;
false ;

is_power_of_two(1/256.0b0) ;
true ;

decode_float(3.0);
[1.5, 1, 1.0];

decode_float(-0.25);
[1.0, - 2, - 1.0];

decode_float(3b0);
[1.5b0, 1, 1.0b0];

decode_float(-0.25b0);
[1.0b0, - 2, - 1.0b0];

decode_float(least_positive_normalized_float);
[1.0, - 1022, 1.0];

decode_float(most_positive_float);
[1.9999999999999998, 1023, 1.0];

/* This assumes denormals are supported .*/
decode_float(least_positive_float);
[1.0, - 1074, 1.0];

integer_decode_float(3.0);
[6755399441055744, - 51, 1];

integer_decode_float(-0.25);
[4503599627370496, - 54, - 1];

integer_decode_float(3b0);
[54043195528445952, - 54, 1];

integer_decode_float(-0.25b0);
[36028797018963968, - 57, - 1];

integer_decode_float(least_positive_normalized_float);
[4503599627370496, - 1074, 1];

integer_decode_float(most_positive_float);
[9007199254740991, 971, 1];

/* This assumes denormals are supported .*/
integer_decode_float(least_positive_float);
[1, - 1074, 1];

scale_float(1.0, 2);
4.0;

scale_float(-1.0, 2);
-4.0;

scale_float(1.0, -5000);
0.0;

/*
 * The second scale_float was determined from integer_decode_float to
 * get the bits, and scaled by -53 to get the final result.
 */
scale_float(most_positive_float, -1024) - scale_float(float(9007199254740991),-53);
0.0;

scale_float(1b0, 2);
4b0;

scale_float(-1b0, 2);
-4b0;

scale_float(0.125b0, 3);
1.0b0;

float_sign(-5.0);
-1.0;

float_sign(5.0);
1.0;

float_sign(0.0);
1.0;

float_sign(-5b0);
-1b0;

float_sign(5b0);
1b0;

float_sign(0b0);
1b0;

float_sign(-0b0);
1b0;

