Jump to content



Photo
- - - - -

How To Display A Number In Max 2 Decimal Points?


  • Please log in to reply
2 replies to this topic

#1 josephlo

josephlo

    Newbie

  • Members
  • Pip
  • 13 posts

Posted 12 April 2008 - 11:11 AM

Hi

I am currently programming using the FX-9860G and would like to ask the following questions:

1. How do I ensure that the numeric output (from a program) is displayed in 2 decimal points? i.e. 216.23 instead of 216.23132343 etc?

2. The programming line I am currently using is like: "Answer is":A. If A is of value 123, this will display "Answer is 123". This is fine. But how do I display something like "Answer is 123 Volts"? How do I append a string behind the variable A in the display output?

Thank you

#2 IbmPad

IbmPad

    Casio Fan

  • Members
  • PipPip
  • 35 posts
  • Location:France
  • Interests:- Programming (PC and Calc)<br />- Old calculators<br />- Piano<br />- Foreign languages

  • Calculators:
    CP-330 / FX-9860G SD / HP-49G+ / HP-48G / AFX 2.0+ / FX-795P / FX-4500P / FX-8500G/ FX-4000P / FX-602P / FX-7000G / FX-6800G / FX-702P / PB-700 / Sharp PC-1403 / Электроника МК-61 / TI-57 II / FX-180PV / FX-82 / FX-82D / FX-92

Posted 12 April 2008 - 11:59 AM

1> You can insert "Fix 2" in your program before displaying A. "Fix" can be found in the SETUP menu and then in DISP.

2> I'm a newbie, so the only method I know is to do something like that :
Fix 2
Locate 1,1,"Answer is "
Locate 11,1,A
Locate (Int log A)+1+11+3,1," Volts"
(Int?log?A)+1?returns?the number of ?integer digits, 11 is the beginning of A and 3 is the point and the 2 decimal digits.

#3 josephlo

josephlo

    Newbie

  • Members
  • Pip
  • 13 posts

Posted 12 April 2008 - 02:06 PM

Thanks. The Fix 2 routine works.

As for using the Locate command for appending a string after the answer, I am just wondering if there is any other way of doing this?


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users