Ubuntu Suomen keskustelualueet
Ubuntun käyttö => Ubuntu tietokoneissa => Aiheen aloitti: larpa - 19.04.07 - klo:22.40
-
Kokeilin tässä komentoriviltä laskinta hämmästyin:
$ bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
sqrt(3)
1
sqrt(a)
0
a=5
b=4
c = sqrt(a*b)
c
4
quit
-----------------------------------------------------------
Kokeilin sitten selventää asiaa:
man bc
OPTIONS
-h, --help
Print the usage and exit.
-i, --interactive
Force interactive mode.
-l, --mathlib
Define the standard math library.
-w, --warn
Give warnings for extensions to POSIX bc.
-s, --standard
Process exactly the POSIX bc language.
-q, --quiet
Do not print the normal GNU bc welcome.
-v, --version
Print the version number and copyright and quit.
----------------------------------------------------------------------------------------------------------------------------------
Pitää ilmeisesti olla tuo math kirjasto käytössä, että toimiipi oikein.
---------------------------------------------------------------------------------------------------------------------------------
$ bc -l
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
sqrt(3)
1.73205080756887729352
sqrt(a)
0
a=5
b=4
c = sqrt(a*b)
c
4.47213595499957939281
quit
jo alkoi toimia ;D
-
Ei aivan. Jos olisit lueskellut sitä man-sivua tarkemmin, olisit huomannut, että pelkkä scale-muuttujan arvon asettaminen (oletus on 0) auttaa:
$ bc
5/2
2
scale=1
5/2
2.5
scale=4
5/2
2.5000