Example of the project nuts.Demo.Float128s for Lazarus

Use of the QScaleB and QILogB functions of the nuts.Float128s unit.

//////////////////////////////////////////////////////////////////////////////// ============== ScaleB & ILogB ============== ------------------- Compiler directives ------------------- NUTS_DEBUG : defined NUTS_THREAD_SAFE : not defined NUTS_ASM_CODE : not defined ------- Context ------- Masks = [feInexact,feUnderflow] Flags = [] Rounding mode = rmTiesToEven ------------------------------------- Q (min subnormal), R := Q >> ILogB(Q) ------------------------------------- Q = 6.47517511943802511092443895822764655e-4966 Q = $0.0000000000000000000000000001p-16382 R = 1.0 R = $1.0 Check (R = 1) : OK ------------------------------------- Q (max subnormal), R := Q >> ILogB(Q) ------------------------------------- Q = 3.36210314311209350626267781732175196e-4932 Q = $0.FFFFFFFFFFFFFFFFFFFFFFFFFFFFp-16382 R = 1.99999999999999999999999999999999961 R = $1.FFFFFFFFFFFFFFFFFFFFFFFFFFFE Check (R = NextDown(NextDown(2.0))) : OK ---------------------------------- Q (min normal), R := Q >> ILogB(Q) ---------------------------------- Q = 3.3621031431120935062626778173217526e-4932 Q = $1.0p-16382 R = 1.0 R = $1.0 Check (R = 1) : OK ----------------------------------------- Q (random in 0..2**50, R := Q >> ILogB(Q) ----------------------------------------- Q = 8.57092053662220888828277588859808781e+7 Q = $1.46F46557702EC5B4C56F0AEC424Ep+26 R = 1.27716668495866788749140141734452364 R = $1.46F46557702EC5B4C56F0AEC424E Check (1 <= R < 2) : OK ---------------------------------- Q (max normal), R := Q >> ILogB(Q) ---------------------------------- Q = 1.18973149535723176508575932662800702e+4932 Q = $1.FFFFFFFFFFFFFFFFFFFFFFFFFFFFp+16383 R = 1.99999999999999999999999999999999981 R = $1.FFFFFFFFFFFFFFFFFFFFFFFFFFFF Check (R = NextDown(2.0)) : OK ////////////////////////////////////////////////////////////////////////////////