Bugs item #1479316, was opened at 2006-04-30 13:48
Message generated for change (Comment added) made by dbaelde
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=591456&aid=1479316&group_id=89802
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Xavier Cazin (xaviercazin)
>Assigned to: David Baelde (dbaelde)
Summary: Error in operators that expect floats
Initial Comment:
While trying using operators that expect floats as
parameters, like "change volume" and "delay", I get the
following message:
liquidsoap -c /etc/liquidsoap/primo.liq
Line 42, char 22 before "1.2": Unknown error
Fatal error: exception Failure("float_of_string")
here, line 42 is:
change_volume(1.2,foo)
When changed to only "foo", it works. Same issue with
"delay(5.0,foo)" for instance.
----------------------------------------------------------------------
>Comment By: David Baelde (dbaelde)
Date: 2006-04-30 22:59
Message:
Logged In: YES
user_id=640545
It might be a locale issue, if you're using french for
example. However, I cannot reproduce it at all. If I guessed
right, the following modification might help.
--- tools/lang_lexer.mll (revision 2435)
+++ tools/lang_lexer.mll (working copy)
@@ -58,7 +58,14 @@
| "true" { BOOL true }
| "false" { BOOL false }
| int_literal { INT (int_of_string (Lexing.lexeme lexbuf)) }
- | float_literal { FLOAT (float_of_string (Lexing.lexeme
lexbuf)) }
+ | (['0'-'9']* as ipart) '.' (['0'-'9']* as fpart)
+ { let fpart = if fpart = "" then 0. else
+ (float_of_string fpart) /.
+ (10. ** (float_of_int (String.length fpart)))
+ in
+ let ipart = if ipart = "" then 0. else
float_of_string ipart in
+ Printf.printf "Got %f\n" (ipart +. fpart) ;
+ FLOAT (ipart +. fpart) }
| var { VAR (Lexing.lexeme lexbuf) }
| '\'' (([^'\''] | '\\' '\'')* as s) '\'' {
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=591456&aid=1479316&group_id=89802