MATLAB: How to get precise conversion in matlab

MATLAB

hi
when i want to convert degrees(89.999999999999668207879992402105) into radians matlab gives 1.5707963267948966192313216916398 value as a output. but when i reverse the process it gives round off figure 90. but i need actual and accurate conversion value not the round off.*
vpa(89.999999999999668207879992402105*pi/180)
ans = 1.5707963267948966192313216916398
but when re-convert back to original form
vpa(1.5707963267948966192313216916398*180/pi)
ans = 90.0
i also change the the number of digits like vpa(1.5707963267948966192313216916398*180/pi,100) etc but observe the same results. kindly help me i will be highly thankful to you for this act of kindness
with best regards mudasir ahmed

Best Answer

Every time you use a literal number in MATLAB that is not inside a string, MATLAB is going to evaluate the number as double precision before the Symbolic toolbox gets control. You need to quote your numbers. You should also get in the habit of sym()'ing them
vpa('89.999999999999668207879992402105*pi/180')
vpa('1.5707963267948966192313216916398*180/pi')
but better
vpa(sym('89.999999999999668207879992402105*pi/180'))
vpa(sym('1.5707963267948966192313216916398*180/pi'))