calculating with add - where is the error?

  • where is the error in the add statement, I mean the trace gives me not %1(=0.31) + 0.1 = 0.41 in result for volume-plus, but it shows:

    Code
    INFO: PARAMETER 1 is 0.31
    INFO: VOLUME-ACTUAL is 0.31
    INFO: VOLUME-PLUS is add(0.31, 0.1)

    heres my action:

    Code
    <action name="soundsettings">
    		set(plugin[vars].volume-actual,%1);
    		trace('PARAMETER 1 is ', %1); 
    		trace('VOLUME-ACTUAL is ', get(plugin[vars].volume-actual)); 
    		if(	%1 LT 1.0, set(plugin[vars].volume-plus,add(%1, 0.1)));
    		trace('VOLUME-PLUS is ', get(plugin[vars].volume-plus));
    	</action>

    thanks in advance!
    Georg

    Einmal editiert, zuletzt von gkaefer (21. November 2011 um 15:32)

  • why is the result in my add calculation 0.30000000000000004 and not 0.3 ?

    $1 is 0.2 than I do add 0.1 for VOLUME-PLUS and do sub 0.1 for VOLUME-MINUS

    debug output:

    Code
    INFO: PARAMETER 1 is 0.2
    INFO: VOLUME-ACTUAL is 0.2
    INFO: VOLUME-PLUS is 0.30000000000000004
    INFO: VOLUME-MINUS is 0.1

    my action:

    Code
    <action name="soundsettings">
    		set(plugin[vars].volume-actual,%1);
    		trace('PARAMETER 1 is ', %1); 
    		trace('VOLUME-ACTUAL is ', get(plugin[vars].volume-actual)); 
    		if(	%1 LT 1.0, add(plugin[vars].volume-plus,%1,0.1),set(plugin[vars].volume-plus,1.0));
    		if(	%1 GT 0.0, sub(plugin[vars].volume-minus,%1,0.1),set(plugin[vars].volume-minus,0.0));
    		showlog();
    		trace('VOLUME-PLUS is ', get(plugin[vars].volume-plus));
    		trace('VOLUME-MINUS is ', get(plugin[vars].volume-minus));
    	</action>

    Liebe Gruesse,
    Georg

  • PS: if I use not 0.2 but 2 and do add 1 and sub 1 instead of the 0.1 than the calculations are correct....

    done all on Win7 64 bit with IE 9 and
    INFO: Panotour Pro Version 1.7.0 Beta 1
    INFO: krpano 1.0.8.14 (build 2011-10-14)

    Georg

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!