Tutorial Addendum On C# - Allotment B - Bifold Representation of float and bifold Ethics
| |
accessible abandoned outputDebugText() {
int i;
Console.WriteLine("======");
Console.WriteLine("Converting a absolute amount to IEEE Stardard 754");
Console.WriteLine("Binary Amphibian Point with Individual Precision:");
Console.WriteLine("");
Console.WriteLine(" Value: {0}",original_value);
Console.WriteLine(" Sign: {0}",sign);
Console.WriteLine(" Exponent: {0}",exponent);
Console.Write(" Fraction: ");
Console.Write("{0}.",lead);
for (i=0; i<fraction_size; i++) {
Console.Write("{0}",fraction[i]);
}
Console.WriteLine("");
Console.Write(" Position: ");
Console.Write("{0} ", );
for (i=0; i<fraction_size; i++) {
Console.Write("{0}",i%10);
}
Console.WriteLine("");
Console.WriteLine("");
}
accessible changeless abandoned Main() {
float v;
IeeeFloat x;
// try 0.0 first
v = 0.0f;
x = new IeeeFloat(v);
Console.WriteLine("{0}, {1}", v, x.toBinaryExpression());
// try 1.0
v = 1.0f;
x = new IeeeFloat(v);
Console.WriteLine("{0}, {1}", v, x.toBinaryExpression());
// try 2.0
v = 2.0f;
x = new IeeeFloat(v);
Console.WriteLine("{0}, {1}", v, x.toBinaryExpression());
// try 0.5
v = 0.5f;
x = new IeeeFloat(v);
Console.WriteLine("{0}, {1}", v, x.toBinaryExpression());
// try 1/3
v = 1.0f/3.0f;
x = new IeeeFloat(v);
Console.WriteLine("{0}, {1}", v, x.toBinaryExpression());
// try 0.1
v = 0.1f;
x = new IeeeFloat(v);
Console.WriteLine("{0}, {1}", v, x.toBinaryExpression());
// try MaxValue
v = float.MaxValue;
x = new IeeeFloat(v);
Console.WriteLine("{0}, {1}", v, x.toBinaryExpression());
// try MinValue
v = float.MinValue;
x = new IeeeFloat(v);
Console.WriteLine("{0}, {1}", v, x.toBinaryExpression());
// try Epsilon
v = float.Epsilon;
x = new IeeeFloat(v);
Console.WriteLine("{0}, {1}", v, x.toBinaryExpression());
// try Epsilon
v = float.Epsilon;
x = new IeeeFloat(v);
x.outputDebugText();
// try 1/3
v = 1.0f/3.0f;
x = new IeeeFloat(v);
x.outputDebugText();
// try MaxValue
v = float.MaxValue;
x = new IeeeFloat(v);
x.outputDebugText();
}
}
Output:
0, b(0.00000000000000000000000)*2**(0)
1, b(1.00000000000000000000000)*2**(0)
2, b(1.00000000000000000000000)*2**(1)
0.5, b(1.00000000000000000000000)*2**(-1)
0.3333333, b(1.01010101010101010101011)*2**(-2)
0.1, b(1.10011001100110011001101)*2**(-4)
3.402823E+38, b(1.11111111111111111111111)*2**(127)
-3.402823E+38, -b(1.11111111111111111111111)*2**(127)
1.401298E-45, b(0.00000000000000000000001)*2**(-127)
======
Converting a absolute amount to IEEE Stardard 754
Binary Amphibian Point with Individual Precision:
Value: 1.401298E-45
Sign: 1
Exponent: -127
Fraction: 0.00000000000000000000001
Position: 01234567890123456789012
======
Converting a absolute amount to IEEE Stardard 754
Binary Amphibian Point with Individual Precision:
Value: 0.3333333
Sign: 1
Exponent: -2
Fraction: 1.01010101010101010101011
Position: 01234567890123456789012
======
Converting a absolute amount to IEEE Stardard 754
Binary Amphibian Point with Individual Precision:
Value: 3.402823E+38
Sign: 1
Exponent: 127
Fraction: 1.11111111111111111111111
Position: 01234567890123456789012
Exercise: Add a new adjustment in IeeeFloat chic to achievement the amount in
IEEE 754 accumulator format, with the afterward adjustment signature:
accessible cord ToBits()
|
TAG: console, writeline, ieeefloat, tobinaryexpression, fraction, exponent, maxvalue, epsilon, position, precision, converting, outputdebugtext, floating, stardard, point, single, 754binary, console writeline, new ieeefloat, writeline {0}, {0} {1}, tobinaryexpression try, console write, 00000000000000000000000 *2**, write {0}, single precision, writeline console, ieee stardard, real number, floating point, point with, precision value, 754binary floating, *2** 127, stardard 754binary, point with single, floating point with, console writeline console, 754binary floating point, single precision value, stardard 754binary floating, ieee stardard 754binary, writeline console writeline, position 01234567890123456789012 converting, i< fraction size, |
Also see ...