Example of the project nuts.Demo.Float128s for Lazarus

Use of the QAdd function of the Float128s unit.

//////////////////////////////////////////////////////////////////////////////// === Add === ------------------- Compiler directives ------------------- NUTS_DEBUG : defined NUTS_THREAD_SAFE : not defined NUTS_ASM_CODE : not defined ------- Context ------- Masks = [feInexact,feUnderflow,feOverflow,feInfinitary,feInvalidOp] Flags = [] Rounding mode = rmTiesToEven ------------- Random values ------------- a = $1.CB309CEC0DAC596805A5AA9F70A0p-3 b = -$1.F499FACB6C3D2F8A2B4F7EEDF49Cp-1 c = a + b = -$1.81CDD39068D2193029E614461874p-1 d = c + (-b) = $1.CB309CEC0DAC596805A5AA9F70A0p-3 e = d + (-a) = $0.0 ------ Zero's ------ a = +$0.0 b = -$0.0 c = a + a = +$0.0 d = a + b = +$0.0 e = b + a = +$0.0 f = b + b = -$0.0 Check (c is +0.0) : OK Check (d is +0.0) : OK Check (e is +0.0) : OK Check (f is -0.0) : OK ---------- Infinities ---------- a = +Infinity b = -Infinity c = a + a = +Infinity d = a + b = NaN e = b + a = NaN f = b + b = -Infinity Check (c = +oo) ................... : OK Check (feInvalidOp flag lowered) .. : OK Check (d is NaN) .................. : OK Check (feInvalidOp flag raised) ... : OK Check (e is NaN) .................. : OK Check (feInvalidOp flag raised) ... : OK Check (f = -oo) ................... : OK Check (feInvalidOp flag lowered) .. : OK ----------------------------- MaxSubnormal and MinSubnormal ----------------------------- a = +$0.FFFFFFFFFFFFFFFFFFFFFFFFFFFFp-16382 b = +$0.0000000000000000000000000001p-16382 c = a + b = +$1.0p-16382 d = b + a = +$1.0p-16382 Check (c is Normal) ............... : OK Check (feUnderflow flag lowered) .. : OK Check (d is Normal) ............... : OK Check (feUnderflow flag lowered) .. : OK Check (c = d) ..................... : OK Check (c = MinNormal) ............. : OK Check (feInexact flag lowered) .... : OK ----- NaN's ----- a = NaN (payload = 1) b = NaN (payload = 2) c = a + 1 = NaN (payload = 1) d = b + 1 = NaN (payload = 2) e = a + b = NaN (payload = 2) f = b + a = NaN (payload = 2) Check (c payload = a payload) : OK Check (d payload = b payload) : OK Check (e payload = b payload) : OK Check (f payload = b payload) : OK ////////////////////////////////////////////////////////////////////////////////