BCX Console Demonstration Program s155.bas

 '**************************************************** 
 '*          Long Double Floating Point Test 
 '   Different compiler may give different results 
 '**************************************************** 
 ' 
 DIM A AS LDOUBLE, A1 AS LDOUBLE, A2 AS LDOUBLE
 DIM C#, C1#, C2#
 DIM B$, E$
 
 'Test the calculations 
 
 A1 = 1.23456789123456789E800
 A2 = 2.34567890234567890E800
 A = A1 + A2
 PRINT "Long Double Addition           : "; A
 A = A1 * A2
 PRINT "Long Double Multiply           : "; A
 
 
 'Test VALL() and STRL$() 
 
 A = VALL("987.123123123123123123E1234")
 PRINT "Long Double Value              : "; A
 B$ = STRL$(A)
 PRINT "Long Double String             : "; B$
 
 
 'Test MKLD() and CVLD() and CLDBL() 
 
 A1 = CLDBL(1.0)
 A2 = CLDBL(4.0)
 A = ATANL(A1) * A2
 PRINT "Long double PI                 : "; A ' Printing without leading 'Space' ? 
 
 
 C1# = CDBL(1.0)
 C2# = CDBL(4.0)
 C# = ATN(C1#) * C2#
 PRINT "Double PI                      : "; C#   ' Printing with leading 'Space' ? 
 
 
 A = 1.23456789123456789E800
 E$ = MKLD$(A)
 A1 = CVLD(E$)
 PRINT "MKLD - Floating var to convert :"; A
 PRINT "MKLD - Len of converted string :"; LEN(E$)
 PRINT "CVLD - Reconv. floating var    :"; A1
 
 
 'Test FRACL() 
 
 A = 12.123456789012345678
 PRINT "Full value                     :"; A
 A = FRACL(A)
 PRINT "Fractional part                :"; A
 
 
 'Test Math Functions() 
 
 A1 = 3.1415
 PRINT "Long doubleSin                 :"; SINL(A1)
 PRINT "Long doubleCos                 :"; COSL(A1)
 PRINT "Long doubleTan                 :"; TANL(A1)
 
 
 A1 = 0.55555555555555555
 
 PRINT "Long double ArcSin             :"; ASINL(A1)
 PRINT "Long double ArcCos             :"; ACOSL(A1)
 PRINT "Long double ArcTan             :"; ATANL(A1)
 A1 = 2.0
 PRINT "Long double Log10              :"; LOG10L(A1)
 PRINT "Long double LogN               :"; LOGL(A1)
 PAUSE
 END
 
 

Result:


 Long Double Addition           :  INF
 Long Double Multiply           :  INF
 Long Double Value              :  INF
 Long Double String             :  INF
 Long double PI                 :  3.14159265358979319
 Double PI                      :  3.14159265358979
 MKLD - Floating var to convert : INF
 MKLD - Len of converted string : 0
 CVLD - Reconv. floating var    : INF
 Full value                     : 12.12345678901234642
 Fractional part                : 0.1234567890123461439
 Long doubleSin                 : 9.265358966049025185E-05
 Long doubleCos                 :-0.9999999957076561259
 Long doubleTan                 :-9.265359005819133017E-05
 Long double ArcSin             : 0.5890309702162739086
 Long double ArcCos             : 0.9817653565786227773
 Long double ArcTan             : 0.507098504392337054
 Long double Log10              : 0.3010299956639812081
 Long double LogN               : 0.6931471805599452637