BCX Console Demonstration Program S155.bas

 
 ' This sample will not compile with the Pelle's C compiler.
 '***********************************
 '* Long Double Floating Point Test *
 '***********************************
 '
 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# = ATAN(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