Post Reply 
Firmware 2021 - Test PRINT and PRINT2D cmds
04-16-2021, 11:17 PM (This post was last modified: 04-28-2021 06:52 PM by compsystems.)
Post: #1
Firmware 2021 - Test PRINT and PRINT2D cmds
Hello hp¹s

In firmware 2021, we have a new PRINT2D command in math book print format. =]

A: PRINT2D does not work in CAS mode =(

Quote:PRINT2D Syntax:
PRINT2D(obj, [font], [color], flags)
PRINTED )
Prints either the result of expr or string to the terminal. The display will be done using textbook display

B: The tab symbol must be invisible in terminal view and visible in edit as ⇥

PHP Code:
    PRINT( "Hello\n\tworld \\ \" " ); //   Hello world \ "
    
PRINT2D"Hello\n\tworld \\ \" " );
    print( 
"Hello\n\tworld \\ \" " ); 

Basic escape characters work great in the code editor, but not yet in the history view =(

Test PRINT & PRINT2D cmds
HOME MODE:

PHP Code:
EXPORT print_cmds_home()
BEGIN
    
PRINT(); // Clear terminal output
    
PRINT( (50 5*6) / ); // 5, evaluates, ok
    
PRINT2D( (50 5*6) / ); // 5, evaluates, ok
    
PRINT( "\n" ); // new line, ok
    
    
PRINT( quote(2) ); // 5^2, 1D without evaluating, ok
    
PRINT( '5 ^ 2' ); // 5^2, 1D without evaluating, ok
    
PRINT2Dquote(2) ); // 5² , 2D without evaluating, ok
    
PRINT2D'5 ^ 2' ); // 5² , 2D without evaluating, ok
    
PRINT( ); // 25, ok
    
PRINT2D); // 25, ok
    
PRINT( "\n" );

    PRINT( 
'(50 - (5*6)) / 4' ); //     1D without evaluating, ok
    
PRINT2D'(50 - (5*6)) / 4' ); // 2D without evaluating, ok
    
PRINT( "\n" );
    
    PRINT( 
"Hello\n\tworld \\ \" " );  //   Hello world \ "
    
PRINT2D"Hello\nworld" );
    PRINT( 
"\n" );

    
PRINT2D'17 / 3' ); // 17/3, rational division without evaluating, ok
    
PRINT2D17 ); // 5.6666... , approximate value calculation, ok
    
PRINT( "\n" );
    
    
PRINT2D'floor(17 / 3)' ); // print as function floor(17 / 3), but ⌊ 17/3 ⌋ is real 2D mathbook print, 8970 (⌊) & 8971(⌋)    unicode char
    
PRINT2Dfloor(17 3) ); // 5, ok, floor division discards the fractional part
    
PRINT( "\n" );
    
    
PRINT2D'ceiling(17 / 3)' ); // print as ceiling(17 / 3), but ⌈ 17/3 ⌉ is real 2D mathbook print, 8968(⌈)/8969(⌉) unicode char
    
PRINT2Dceiling(17 3) ); // 6
    
PRINT( "\n" );
    
    
PRINT2D'17 MOD 3' ); // 17 MOD 3
    
PRINT2D17 MOD 3 ); // 2, ok, the MOD operator returns the remainder of the division
    
PRINT( "\n" );
    
    
PRINT2D'abs(3+4*i)' ); // | 3 + 4i |, ok
    
PRINT2Dabs(3+4*i) ); // 5, ok
    
PRINT( "\n" );

    RETURN( 
"Done" );
END

Test print (lowercase) cmd
CAS MODE:
PHP Code:
#cas
print_cmds_cas():=
BEGIN
    
print(); // Clear terminal output
    
print( (50 5*6) / ); // 5, evaluates, ok
    
print( (50 5*6) / ); // 5, evaluates, ok
    
print( "\n" ); // still not print new line =(
    
    
print( string(quote(2) )); // "5^2", 1D without evaluating
    
print( string('5 ^ 2') ); // "5^2", 1D without evaluating
    
print( quote(2) ); // 5² , 2D without evaluating, ok
    
print( '5 ^ 2' ); // 5² , 2D without evaluating, ok
    
print( ); // 25, ok
    
print( ); // 25, ok
    
print( "\n" );

    print( 
string('(50 - (5*6)) / 4' )); //  1D without evaluating
    
print( '(50 - (5*6)) / 4' ); // 2D without evaluating, ok
    
print( "\n" );
    
    print( 
"Hello\n\tworld \\ \" " );  //   Hello world \ "
    
print( "Hello\nworld" );
    print( 
"\n" );

    print( 
'17 / 3' ); // 17/3, rational division without evaluating, ok
    
print( 17 3. ); // 5.6666... , approximate value calculation, ok
    
print( "\n" );
    
    print( 
'floor(17 / 3)' ); // print as function floor(17 / 3), but ⌊ 17/3 ⌋ is real 2D mathbook print, 8970 (⌊) & 8971(⌋)  unicode char
    
print( floor(17 3) ); // 5, ok, floor division discards the fractional part
    
print( "\n" );
    
    print( 
'ceiling(17 / 3)' ); // print as ceiling(17 / 3), but ⌈ 17/3 ⌉ is real 2D mathbook print, 8968(⌈)/8969(⌉) unicode char
    
print( ceiling(17 3) ); // 6
    
print( "\n" );
    
    print( 
'17 MOD 3' ); // 17 MOD 3
    
print( 17 MOD 3 ); // 2, ok, the MOD operator returns the remainder of the division
    
print( "\n" );
    
    print( 
'abs(3+4*i)' ); // | 3 + 4i |, ok
    
print( abs(3+4*i) ); // 5, ok
    
print( "\n" );

    RETURN( 
"Done" );
END;
#end 

output comparison between HOME and CAS
[Image: print2d_hp_prime_2021_img00.png]
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Firmware 2021 - Test PRINT and PRINT2D cmds - compsystems - 04-16-2021 11:17 PM



User(s) browsing this thread: 1 Guest(s)