You are not logged in.
Pages: 1
Hi,
In the calculator plugin
https://docs.xfce.org/panel-plugins/xfc … ugin/start
Is there a way to set the number of digits to which results will be rounded?.
For now 1/3 gives 0.3333333333333333 and reducing the number of digits doesn't affect rounding only the visible part.
Thanks
Offline
Unfortunately, the output is hard-coded to 16 digits. Interesting, that they are forcing %g to 16 digits - because of its nature it will by default use the shortest representation of %e or %f (Here is a good discussion about this).
Editing that piece of code to specify just "%g" yields better results. For example:
- 1/2 = 0.333333
- pi = 3.14159
- 1/198 = 0.00505051
- 1/19 = 0.0526316
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Thanks.
If I'm fine with 3 decimal digits should that be changed to %.3f ?
Offline
Thanks.
If I'm fine with 3 decimal digits should that be changed to %.3f ?
If its for your personal use and you will be building and maintaining your own copy of the source, then you can do as you choose.
For the official release, I think it would be best to add functionality to allow the user to specify a rounding value (e.g. round after x decimals).
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
It's for personal use and I'm just modifying to suit my needs. I fully agree rounding should be user controlled.
Is autogen run as configure (with the --prefix and --libdir switches)?. I'm on sparky rolling (=deb testing).
Thanks
Last edited by jt1122 (2021-05-17 09:21:25)
Offline
Is autogen run as configure (with the --prefix and --libdir switches)?. I'm on sparky rolling (=deb testing).
Yes, it should be. And because debian splits the location of the 32 and 64 it library files, you should use something like:
./autogen.sh --prefix=/usr --libdir=/lib/$(uname -m)-linux-gnu
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Pages: 1
[ Generated in 0.009 seconds, 7 queries executed - Memory usage: 536.28 KiB (Peak: 537.13 KiB) ]