Post Reply 
Getting 'N/D' to eval as a fraction not a decimal
03-05-2015, 07:57 AM
Post: #1
Getting 'N/D' to eval as a fraction not a decimal
In a program, I want to generate a fraction e.g.
N:=1 ; D:=2; RETURN 'N/D';

I've tried the following:
Code:
PRINT('N/D');             => N/D
PRINT(EVAL('N/D');        => 0.5
PRINT(CAS.exact('N/D'));  => N/D
PRINT(CAS.exact(N/D));    => 1/2
Clearly, the last one does what I want but it seems a bit wasteful to have to convert N/D to a decimal fraction and then convert it back again to a proper fraction (if I've understood the exact() function correctly).

Am I missing something here? Surely there must be a simpler way that builds the fraction directly?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Getting 'N/D' to eval as a fraction not a decimal - BruceH - 03-05-2015 07:57 AM



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