Variable Converted from Decimal to Fraction

Variable Converted from Decimal to Fraction - Calculated variable shown as fraction when used in subsequent calculation - Messages

#1 Posted: 1/14/2016 6:44:58 AM
Kyle

Kyle

0 likes in 2 posts.

Group: User

Hi all,
I define the variables a, b, and c and then use them in a calculation defining the variable x as follows:
a:=2
b:=3
c:=4
x:=a+b/c=2.75

And then I use the variable x in another calculation:
y:=a+b+x

If I use optimization "None" to show the values used in the calculation of y, SMath automatically converts x from decimal form to fraction.
I need it to show the decimal form of x as follows:
y=2+3+2.75

Instead of:
y=2+3+11/4

Does anyone know of a way to do this? Thanks for your help in advance.
#2 Posted: 1/14/2016 2:25:05 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Just like this: press = after your equation.
There is nothing to "Optimze" the arithmetic
is between registers. You can have fraction
but fractions that don't terminate will need
be expressed in symbolic optimiz...

There is lot lot lot on that: keep posting.

Jean

Forum Help.sm (3 KiB) downloaded 37 time(s).
#3 Posted: 1/14/2016 3:56:37 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

... the image

ForumResult.bmp
#4 Posted: 1/15/2016 12:06:22 AM
Kyle

Kyle

0 likes in 2 posts.

Group: User

Everyone,
Thank you for your replies. I may not have explained what I am looking for clearly. I am creating engineering calculations, and I need to show the values used in each step of the calculation so the work can be checked. In my example, I need to use optimization "None" to show the values used to calculate y, not just the result for y. My problem is that SMath is automatically converting the value for x to a fraction when it is used in the calculation for y. It is difficult to check the calculation if the result for x is shown in decimal form, and then is shown as a fraction when it is used in a subsequent step in the calculation. See below:

a:=2
b:=3
c:=4

x:=a+b/c
x=2.75 <--Here x is shown in decimal form

y:=a+b+x
y=2+3+11/4 <--I need to use optimization "None" to show the values used to calculate y, but x is automatically converted to 11/4 instead of being shown as 2.75
y=7.75

I need the calculation of y to show the decimal form of x so that someone else can check the calculation without having to convert 11/4 to 2.75 in their head.
The desired result is:

y:=a+b+x
y=2+3+2.75 <-- the value of x would be shown as 2.75 not 11/4
y=7.75

I hope this explains what I am looking for better. Thanks again for the replies.

  • New Posts New Posts
  • No New Posts No New Posts