• ×
    Information
    Need Windows 11 help?
    Check documents on compatibility, FAQs, upgrade information and available fixes.
    Windows 11 Support Center.
  • post a message
  • ×
    Information
    Need Windows 11 help?
    Check documents on compatibility, FAQs, upgrade information and available fixes.
    Windows 11 Support Center.
  • post a message
Guidelines
Are you having HotKey issues? Click here for tips and tricks.
Check out our WINDOWS 11 Support Center info about: OPTIMIZATION, KNOWN ISSUES, FAQs, VIDEOS AND MORE.
HP Recommended
 Hello, I would  like to know how to convert the default Real type to Integer type (INT) from the INPUT command. I need it to then apply other instructions that only apply to Integers. I specify that I have an HP Prime G2 calculator. And that I use the HP PPL language. Thank you.
 
2 REPLIES 2
HP Recommended

Hi wChris79_DS,

 

Welcome to the HP support community.
 

I understand that you are facing an issue with your computer, I am glad to assist you today.

 

To convert a REAL type to an INTEGER type in HP Prime's HP PPL (HP Prime Programming Language), you can use the ROUND or TRUNC functions to get an integer value from a real number. Here’s how you can do it:

Using ROUND: This function rounds a real number to the nearest integer. For example:

Using TRUNC: This function truncates the decimal part and keeps only the integer part of the real number. For example:

Using INT: This function can also be used to convert a real number to an integer by truncating the decimal part.

Make sure to choose the method that best fits your needs based on whether you want to round or simply truncate the decimal part. Once you have your integer value, you can proceed with instructions that require integer input.

I hope this helps! Let me know if you have any more questions.

ppl

Copy code

input := 3.7;      // This is your real number integer_value := INT(input); // Converts it to integer

ppl

Copy code

input := 3.7;      // This is your real number integer_value := TRUNC(input); // Converts it to integer

ppl

Copy code

input := 3.7;      // This is your real number integer_value := ROUND(input); // Converts it to integer

 

Regards,

HP

 

Raj2111
I am an HP Employee

HP Recommended

Hi @wChris79_DS ,

 

We did not hear from you after I replied to your post that you had created on HP Support Community.

 

This is a follow-up to know if the issue that you were facing with your HP product still persists,  kindly help me with the details requested to assist you further.

 

Take care and have a great day ahead!

 

Regards,

Raj

Raj2111
I am an HP Employee

† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the <a href="https://www8.hp.com/us/en/terms-of-use.html" class="udrlinesmall">Terms of Use</a> and <a href="/t5/custom/page/page-id/hp.rulespage" class="udrlinesmall"> Rules of Participation</a>.