Long decimal results instead of scientific notation?  Printable Version + HP Forums (https://www.hpmuseum.org/forum) + Forum: HP Calculators (and very old HP Computers) (/forum3.html) + Forum: HP Prime (/forum5.html) + Thread: Long decimal results instead of scientific notation? (/thread17156.html) 
Long decimal results instead of scientific notation?  matalog  06232021 09:08 PM Is there a way to get the prime to show all possible leading zeroes in CAS (or normal) mode, for example, to show 0.00000000000000000000981 instead of 9.81E21? I have it in standard notation mode. RE: Long decimal results instead of scientific notation?  rprosperi  06232021 09:17 PM I'm no Prime guru, but it seems unlikely, 'cuz what should it show if the number was 1.0E250? 250 leading zeros? RE: Long decimal results instead of scientific notation?  Liamtoh Resu  06232021 09:55 PM I would try using the logarithm of the number to create a string of zeroes and padding the significant numbers to the end. The log of 9.81e21 is about 20.00833988260. Use the absolute value of the integer. Create a loop to make the zero padded string. Pad the string with 981. There may be a simpler way. It is like programming in c where you have to create your own string functions. I hope this will help get you started. RE: Long decimal results instead of scientific notation?  Joe Horn  06242021 03:33 AM (06232021 09:08 PM)matalog Wrote: Is there a way to get the prime to show all possible leading zeroes in CAS (or normal) mode, for example, to show 0.00000000000000000000981 instead of 9.81E21? Sort of. In CAS, the command: format(9.81E21,"f23") returns the string "0.00000000000000000000981" A program could be written, I suppose, which would calculate the necessary second argument of format() to obtain the desired output for any given input. If you're looking for a display mode that automatically displays all leading zeros, sorry, there is no such mode. RE: Long decimal results instead of scientific notation?  Liamtoh Resu  06242021 01:16 PM I came up with a program to print 9.81e21 in the format you wanted. It is free form, off the cuff, coding at the keyboard with no optimization. I hope to recode it later. Code:
Not one for the software engineers but it gets the job done. Cheers. RE: Long decimal results instead of scientific notation?  Liamtoh Resu  06252021 04:09 AM Take a look at this program. Type a number, eg. 9.81e21 on the command line in HOME. Type PLZ to launch. It will print and return the desire format on to the stack. You can change the print() statement to msgbox if you want. There is a variable named sf if you want to change the number of siginificant figures. Thanks for the tip about getting input via Ans(1). edit: This is very alpha software. It seems to work with numbers less than one. It will not work in CAS mode. Perhaps the second trunc function should be a Round function. Perhaps this program can serve as a base for another one. There are limitations when the exponent is less that 100. Perhap a version that did not depend on logarithms and exponents would work better. Code:
