We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › conversion float()
Page Index Toggle Pages: 1
conversion float() (Read 937 times)
conversion float()
May 24th, 2005, 12:26am
 
funny thing... I was trying to test some sonia old example with the new library and the compiler gives to me a strange error. In fact at this line:

Code:
float(i*oneCycle*freq) 



where i and freq are int and freq is float, it says: perhaps you wanted the overload version "float toFloat(boolean $1);" instead?

and with the int conversion:

Code:
int(i*oneCycle*freq) 



doesn't give any problem. Any reason?


thanks, chr
Re: conversion float()
Reply #1 - May 24th, 2005, 10:19am
 
This works for me:

Code:

int a = 3, b = 2, c = 1;
float d = 0;
d = (float)(a+b+c);
println(d);


-seltar
Re: conversion float()
Reply #2 - May 24th, 2005, 11:28am
 
yeah, with the casting it works

Code:
(float)(i*oneCycle*freq) 



but I presume it should work also with the function "float()" like in the past versions, shouldn't it?


thx, chr
Re: conversion float()
Reply #3 - May 25th, 2005, 3:40am
 
yup, this is (one of the few) bugs filed in the bugs db:
http://processing.org/bugs/show_bug.cgi?id=4

we'll fix it before 1.0 but it's a little lower priority since there is a workaround in the meantime. the preprocessor hasn't changed between alpha and beta, so they should be equally buggy.
Page Index Toggle Pages: 1