B4P handles all numerals as double precision floating point numbers, regardless how they are used, ranging from loop indexing to performing scientific calculations. Two subtypes are suppported:
Numbers parsed in B4P program code text or read from tables come with both numeric values and associated text presentation. Following rules apply:
a[0] = 123.45;
a[1] = 007;
a[2] = 20.20;
a[3] = num( '1.5E-3' ); // String representation will not be included here
a[4] = 0.00;
for all variables( a[], b[] )
{
c[] = str(b[]); // Recover string representation
d[] = b[] + 0; // String representation gets dropped because a calculation has been made
e[] = str(d[]); // Convert back to string representation
echo;
echo("For following numeral : ", b[], " subtype: ", subtype(b[]) );
echo(" String representation : ", c[], " subtype: ", subtype(c[]) );
echo(" Converted to plain numeral: ", d[], " subtype: ", subtype(d[]) );
echo(" Back to string again : ", e[], " subtype: ", subtype(e[]) );
}For following numeral : 123.45 subtype: numeral
String representation : 123.45 subtype: quoted string
Converted to plain numeral: 123.45 subtype: plain numeral
Back to string again : 123.45 subtype: quoted string
For following numeral : 007 subtype: numeral
String representation : 007 subtype: quoted string
Converted to plain numeral: 7 subtype: plain numeral
Back to string again : 7 subtype: quoted string
For following numeral : 20.20 subtype: numeral
String representation : 20.20 subtype: quoted string
Converted to plain numeral: 20.2 subtype: plain numeral
Back to string again : 20.2 subtype: quoted string
For following numeral : 0.0015 subtype: plain numeral
String representation : 0.0015 subtype: quoted string
Converted to plain numeral: 0.0015 subtype: plain numeral
Back to string again : 0.0015 subtype: quoted string
For following numeral : 0.00 subtype: numeral
String representation : 0.00 subtype: quoted string
Converted to plain numeral: 0 subtype: plain numeral
Back to string again : 0 subtype: quoted string