Example #1
0
 public BasicPriority(PriorityType pt, double value)
 {
     this.PriorityType = pt;
     Percent           = new FloatingPointValue {
         Value = value
     };
 }
Example #2
0
        public override string ToString()
        {
            string ans;

            ans = "Numerical value: " + NumericValue.ToString() + Environment.NewLine +
                  "Floating point value: " + FloatingPointValue.ToString() + Environment.NewLine +
                  "Rational value " + RationalNumeratorValue.ToString() + "/" + RationalDenominatorValue;
            if (MeasurmentUnitCodeSequence != null)
            {
                ans = ans + Environment.NewLine + " Measurement units sequence --> " + Environment.NewLine + MeasurmentUnitCodeSequence.ToString();
            }
            return(ans);
        }
Example #3
0
File: Heap.cs Project: enif77/EFrt
        /// <summary>
        /// Reads a double from an array of bytes.
        /// </summary>
        /// <param name="addr">A value index, aka address.</param>
        /// <returns>A double value.</returns>
        public double ReadDouble(int addr)
        {
            var mem = Items;
            var fp  = new FloatingPointValue();

            fp.B  = (int)mem[addr++];
            fp.B |= (int)mem[addr++] << 8;
            fp.B |= (int)mem[addr++] << 16;
            fp.B |= (int)mem[addr++] << 24;

            fp.A  = (int)mem[addr++];
            fp.A |= (int)mem[addr++] << 8;
            fp.A |= (int)mem[addr++] << 16;
            fp.A |= (int)mem[addr] << 24;

            return(fp.F);
        }
Example #4
0
File: Heap.cs Project: enif77/EFrt
        /// <summary>
        /// Writes a double value to an address.
        /// </summary>
        /// <param name="addr">A value index, aka address.</param>
        /// <param name="value">A value.</param>
        public void Write(int addr, double value)
        {
            var mem = Items;
            var fp  = new FloatingPointValue()
            {
                F = value
            };

            mem[addr++] = (byte)fp.B;
            mem[addr++] = (byte)(fp.B >> 8);
            mem[addr++] = (byte)(fp.B >> 16);
            mem[addr++] = (byte)(fp.B >> 24);

            mem[addr++] = (byte)(fp.A);
            mem[addr++] = (byte)(fp.A >> 8);
            mem[addr++] = (byte)(fp.A >> 16);
            mem[addr]   = (byte)(fp.A >> 24);
        }
Example #5
0
 public abstract int CompareTo(FloatingPointValue other);
Example #6
0
 public void GivenICreateANewFloatingPointNumberWithDefaults() => fp = new FloatingPointValue();
Example #7
0
 public void GivenIHaveAFloatingPointNumberOf(double num) => fp = new FloatingPointValue
 {
     Value = num
 };