[yast-devel] YCP and Float
Hi Protectors Of YCP, which is the easiest way to display a float with 3 digits after the decimal point and rounding to zero? ciao Arvin -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Wed, Mar 26, 2008 at 05:16:56PM +0100, Arvin Schnell wrote:
Hi Protectors Of YCP,
which is the easiest way to display a float with 3 digits after the decimal point and rounding to zero?
Piece of, er, cake. Attached. -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu
On Wed, Mar 26, 2008 at 06:30:00PM +0100, Martin Vidner wrote:
On Wed, Mar 26, 2008 at 05:16:56PM +0100, Arvin Schnell wrote:
Hi Protectors Of YCP,
which is the easiest way to display a float with 3 digits after the decimal point and rounding to zero?
Piece of, er, cake. Attached.
After introducing the builtins trunc and pow it's really a pice of cake (even with variable number of digits): string r3(float a, integer n) { const float factor = pow(10.0, tofloat(n)); return tostring(trunc(a * factor) / factor, n); } ciao Arvin PS: You have to start adding builtins some day ;) -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
Arvin Schnell napsal(a):
On Wed, Mar 26, 2008 at 06:30:00PM +0100, Martin Vidner wrote:
On Wed, Mar 26, 2008 at 05:16:56PM +0100, Arvin Schnell wrote:
Hi Protectors Of YCP,
which is the easiest way to display a float with 3 digits after the decimal point and rounding to zero? Piece of, er, cake. Attached.
After introducing the builtins trunc and pow it's really a pice of cake (even with variable number of digits):
string r3(float a, integer n) { const float factor = pow(10.0, tofloat(n)); return tostring(trunc(a * factor) / factor, n); }
And again, ... we have YaST-core incompatibility with the rest of YaST. Installing the new yast2-core again means that you have to reinstall all other YaST packages. We were discussing that before but nothing has happened. The $current yast2-core should provide some unique $string (changed with every backward-incompatible change) and all another yast2 packages should require it (dependency automatically added during build). Or does anybody have a better idea? L.
On Mon, Apr 07, 2008 at 09:48:34AM +0200, Lukas Ocilka wrote:
Arvin Schnell napsal(a):
On Wed, Mar 26, 2008 at 06:30:00PM +0100, Martin Vidner wrote:
On Wed, Mar 26, 2008 at 05:16:56PM +0100, Arvin Schnell wrote:
Hi Protectors Of YCP,
which is the easiest way to display a float with 3 digits after the decimal point and rounding to zero? Piece of, er, cake. Attached.
After introducing the builtins trunc and pow it's really a pice of cake (even with variable number of digits):
string r3(float a, integer n) { const float factor = pow(10.0, tofloat(n)); return tostring(trunc(a * factor) / factor, n); }
And again, ... we have YaST-core incompatibility with the rest of YaST. Installing the new yast2-core again means that you have to reinstall all other YaST packages.
Are you sure about that? I could add the two builtins and didn't
recompile all YaST modules. And everything works. The yast2-core
testsuite runs fine (including 9.1 bytecode compatibility tests).
Maybe you have problems with libxcrypt.
ciao Arvin
--
Arvin Schnell,
Arvin Schnell napsal(a):
On Mon, Apr 07, 2008 at 09:48:34AM +0200, Lukas Ocilka wrote:
And again, ... we have YaST-core incompatibility with the rest of YaST. Installing the new yast2-core again means that you have to reinstall all other YaST packages.
Are you sure about that? I could add the two builtins and didn't recompile all YaST modules. And everything works. The yast2-core testsuite runs fine (including 9.1 bytecode compatibility tests).
Maybe you have problems with libxcrypt.
Well, it might have been caused by one of the previous changes in core. Some built-in has internally changed, or am I wrong? Don't compile yast2-core, use the one from FACTORY/built-rpms. Some yast2-core incompatibility is really there... L.
On Mon, Apr 07, 2008 at 10:11:48AM +0200, Lukas Ocilka wrote:
Arvin Schnell napsal(a):
On Mon, Apr 07, 2008 at 09:48:34AM +0200, Lukas Ocilka wrote:
And again, ... we have YaST-core incompatibility with the rest of YaST. Installing the new yast2-core again means that you have to reinstall all other YaST packages.
Are you sure about that? I could add the two builtins and didn't recompile all YaST modules. And everything works. The yast2-core testsuite runs fine (including 9.1 bytecode compatibility tests).
Maybe you have problems with libxcrypt.
Well, it might have been caused by one of the previous changes in core. Some built-in has internally changed, or am I wrong?
I added and extended builtins. AFAIK that does not cause trouble and it didn't for me. (It could if a YCP function with the same name as the builtins already exist but I greped for the new names.)
Don't compile yast2-core, use the one from FACTORY/built-rpms.
Some yast2-core incompatibility is really there...
Yes, libxcrypt. Maybe more.
ciao Arvin
--
Arvin Schnell,
participants (3)
-
Arvin Schnell
-
Lukas Ocilka
-
Martin Vidner