08-26-2018, 12:56 PM (This post was last modified: 08-26-2018 03:01 PM by compsystems.)
Post: #1
 compsystems Senior Member Posts: 1,201 Joined: Dec 2013
Hello
In a presentation of computer algebraic systems, I show the difference between numerical and symbolic languages

Sample
PHP Code:
#include<stdio.h>int main() {    printf("%f",x+1);    return 0;}
output: error: 'x' was not declared in this scope

PHP Code:
#include <iostream>using namespace std;int main(int argc, char *argv[]) {    cout << 4/3+1/3 << endl;    return 0;}
output: 1

in the hp-prime
print(4/3+1/3) [enter] show 5/3 ok
but then [esc] show 0 ?

in c++ the output return 0; but the CAS is not c/c++, for this reason this generates confusion on history view, when run the hp-prime in a classroom or you want to take a screenshot

try
print(4/3+1/3) -> 0

Please HP-team return the word "Done" (history view) instead of the number 0 or best the last printing statement

print(4/3+1/3) [enter] show 5/3 ok
but then [esc] -> 5/3

The following screenshot shows the problem by showing zero the sum of the numbers 4/3+1/3.

Attached File(s) Thumbnail(s)

LO SUFICIENTEMENTE BUENO ES ENEMIGO DE LA EXCELENCIA.
08-26-2018, 01:25 PM
Post: #2
 Tim Wessman Senior Member Posts: 2,206 Joined: Dec 2013
RE: Request: "Done" instead of 0
We've been over this for about 5 years now. This does not improve clarity in any way and simply makes the lives of anyone trying to test output difficult. You constantly want to be converting things into strings, error messages and other things that don't belong there.

I'm sorry if you feel otherwise, but apart from you I've not ever heard a single person complaining in this direction. No educator, no instructor, and noone doing development.

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
08-26-2018, 01:58 PM (This post was last modified: 08-27-2018 02:54 PM by compsystems.)
Post: #3
 compsystems Senior Member Posts: 1,201 Joined: Dec 2013
RE: Request: "Done" instead of 0
this request to replace 0 -> last expression of print, it is so simple that it would take a few seconds to change the code, above I explain the cause and effect of this change, it is not because I want it but it gives clarity.

Anyone else that supports my request?

Thanks

LO SUFICIENTEMENTE BUENO ES ENEMIGO DE LA EXCELENCIA.
08-27-2018, 09:45 AM (This post was last modified: 08-27-2018 09:48 AM by ijabbott.)
Post: #4
 ijabbott Senior Member Posts: 781 Joined: Jul 2015
RE: Request: "Done" instead of 0
The text written by PRINT(Expr) is a "side effect" of the function, and need not be related to its return value. Giac currently chooses to return 0. The print() function in Python chooses to return None. The printf() function in C chooses to return the number of characters written. There is no "One True Way"™.

— Ian Abbott
 « Next Oldest | Next Newest »

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