Getting 'N/D' to eval as a fraction not a decimal
03-05-2015, 07:57 AM
Post: #1
 BruceH Senior Member Posts: 510 Joined: Dec 2013
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?
 « Next Oldest | Next Newest »

 Messages In This Thread Getting 'N/D' to eval as a fraction not a decimal - BruceH - 03-05-2015 07:57 AM RE: Getting 'N/D' to eval as a fraction not a decimal - Joe Horn - 03-06-2015, 03:50 AM RE: Getting 'N/D' to eval as a fraction not a decimal - BruceH - 03-06-2015, 08:32 PM RE: Getting 'N/D' to eval as a fraction not a decimal - Joe Horn - 03-07-2015, 01:48 AM RE: Getting 'N/D' to eval as a fraction not a decimal - BruceH - 03-07-2015, 06:31 AM RE: Getting 'N/D' to eval as a fraction not a decimal - Joe Horn - 03-09-2015, 02:21 AM RE: Getting 'N/D' to eval as a fraction not a decimal - BruceH - 03-09-2015, 10:21 PM RE: Getting 'N/D' to eval as a fraction not a decimal - Joe Horn - 03-10-2015, 04:24 AM RE: Getting 'N/D' to eval as a fraction not a decimal - Han - 03-10-2015, 03:46 AM RE: Getting 'N/D' to eval as a fraction not a decimal - cyrille de brĂ©bisson - 03-10-2015, 06:26 AM RE: Getting 'N/D' to eval as a fraction not a decimal - Joe Horn - 03-11-2015, 04:23 AM RE: Getting 'N/D' to eval as a fraction not a decimal - cyrille de brĂ©bisson - 03-11-2015, 06:18 AM RE: Getting 'N/D' to eval as a fraction not a decimal - Joe Horn - 03-11-2015, 06:23 PM

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