-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Tsu-Fan Cheng wrote: > hi ... > i need to use mkxvcd script to create movies, but it gave me error > messages. After some debugging I found out it's because (I guess) that > mplayer use floating point expression instead of integer when identifying > the length of the movie, like 208.15 or something. Anyway, when mkxvcd > trying to decide how many hours this movie has by code: > HOURS=$[quant/3600], which quant means the length, > the script can't handle it and exit. > The script is written in Bash, and I am not so much of a expert, can > someone > suggest me the next step?? much appreciated!! > > > TFC
Answer about whether or not floating point arithmetic is possible in bash (from <http://tldp.org/LDP/abs/html/ops.html>): Caution Bash does not understand floating point arithmetic. It treats numbers containing a decimal point as strings. Why not... A. Brute force the math a bit with Bash? 1. Divide the integer portion. 2. Subtract the quotient. 3. Take the decimal remainder and multiply it by 100 (or 1000 or whatever the max precision is for the number), and use that as your decimal value B. Program your solution using a different method / language? It's quite simple to accomplish this using either Perl or C. - -Garrett -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFgKGrEnKyINQw/HARAqyGAKCipeiM62ACpCEIjrYrZJqT0tdK1gCeJVRk FrMS1VUcScc000QIc1xPsaU= =ZCQS -----END PGP SIGNATURE----- _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"