[Thread Prev][Thread Next][Index]

Re: [ferret_users] backquote, precision, digits after decimal point

Je Sun, 11 Mar 2018 15:02:06 +0900 skribis Ryo:
> [...] I wonder how you get zeros AFTER the decimal point from the backquote
> expression?  say "3.000"?
>     yes? say `3,p=4` `3,p=-4`
> I expected something like "3.0000" from this example but I got just "3". w=
> or zw= didn't help.  (By the way, what do you call the part of a fractional
> number after the decimal point in English? I mean the part "14" of "3.14",
> for example.)

That is the fractional part [0].

[0]: https://en.wikipedia.org/wiki/Radix_point

Thus, the number of decimal places is the same as the length of the
fractional part.

> The ferret manual says that this is by design:
> http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/variables-xpressions/EMBEDDED-XPRESSIONS
> Currently I got stuck. I need character strings like "26.0" for potential
> density labels in my plots and filenames but I don't know how to generate
> them.  (Okay, I do know some workarounds, which includes using SPAWN to
> call the unix/linux command "printf" or calling Ferret from within a shell
> script, but . . . )
> As suggested in the above email thread, it would be nice if a comprehensive
> formatting is possible.  For example,
>    `3,p=(F5.2)` -> " 3.00"
> or perhaps
>     let mylabel = printf("%5.2f", someexpression)
> Fortran or printf formatting would be nice.

I would also find that to be useful.

My attention got drawn to this post because of the issue of number of
decimal places in plots, which may be the same issue or related somehow.
Apparently this is not trivial to solve in Ferret [1, 2].

[1]: https://www.pmel.noaa.gov/maillists/tmap/ferret_users/fu_2017/msg00618.html
[2]: https://savannah.nongnu.org/bugs/?51855


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement