Long decimal results instead of scientific notation?
|
06-23-2021, 09:08 PM
Post: #1
|
|||
|
|||
Long decimal results instead of scientific notation?
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.81E-21?
I have it in standard notation mode. |
|||
06-23-2021, 09:17 PM
Post: #2
|
|||
|
|||
RE: Long decimal results instead of scientific notation?
I'm no Prime guru, but it seems unlikely, 'cuz what should it show if the number was 1.0E-250? 250 leading zeros?
--Bob Prosperi |
|||
06-23-2021, 09:55 PM
Post: #3
|
|||
|
|||
RE: Long decimal results instead of scientific notation?
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.81e-21 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. |
|||
06-24-2021, 03:33 AM
Post: #4
|
|||
|
|||
RE: Long decimal results instead of scientific notation?
(06-23-2021 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.81E-21? Sort of. In CAS, the command: format(9.81E-21,"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. <0|ΙΈ|0> -Joe- |
|||
06-24-2021, 01:16 PM
Post: #5
|
|||
|
|||
RE: Long decimal results instead of scientific notation?
I came up with a program to print 9.81e-21 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. |
|||
06-25-2021, 04:09 AM
(This post was last modified: 06-25-2021 05:09 AM by Liamtoh Resu.)
Post: #6
|
|||
|
|||
RE: Long decimal results instead of scientific notation?
Take a look at this program.
Type a number, eg. 9.81e-21 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:
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)