Page 2 of 2

Re: Best way to keep aspect ratio?

Posted: Mon Dec 16, 2024 6:38 pm
by buddhabas
emcodem wrote: Mon Dec 16, 2024 6:34 pm after reading your workflow from PM (thanks!), i sense the only problem you have is a wrong function name. You have $roundd but you need $round instead. Found a typo in documentation and notified steinar for correction of the same.
It's not a typo. There are 3 similar functions:
https://www.ffastrans.com/wiki/doku.php ... _functions

Re: Best way to keep aspect ratio?

Posted: Mon Dec 16, 2024 6:49 pm
by emcodem
You are faster than steinar :D
Anyway, it seemed to work with $round instead of $roundd...
Try in a populate processor, set s_success to:

$roundd(409/2,0)*2
dont work

$round(409/2,0)*2
works

$roundu(409/2,0)*2
dont work

when you change the number to "2.0" or "2" instead of "2,0", all 3 functions work.
A short talk to steinar revealed that in his post before, the comma was intended to be actually a parameter to the roundd function but it does not take parameters(anymore?)... the old post is now corrected to avoid future users errors.
So after all, the real issue with this all is that $round does take a second argument, thus it reacts to 2,0 (treating 0 as second arg), while $roundd does not support an argument thus it just fails.

By pure accident, i was right that we need to update the inbuilt documentation because $roundd is documented with this example but it does acutally not take a 2nd parameter.
$roundd(number to round =number/%f_variable%[, number of output decimals = integer/%i_variable%])
:D

Re: Best way to keep aspect ratio?

Posted: Mon Dec 16, 2024 8:02 pm
by buddhabas
emcodem wrote: Mon Dec 16, 2024 6:49 pm You are faster than steinar :D
Anyway, it seemed to work with $round instead of $roundd...
Try in a populate processor, set s_success to:

$roundd(409/2,0)*2
dont work

$round(409/2,0)*2
works

$roundu(409/2,0)*2
dont work

when you change the number to "2.0" or "2" instead of "2,0", all 3 functions work.
A short talk to steinar revealed that in his post before, the comma was intended to be actually a parameter to the roundd function but it does not take parameters(anymore?)... the old post is now corrected to avoid future users errors.
So after all, the real issue with this all is that $round does take a second argument, thus it reacts to 2,0 (treating 0 as second arg), while $roundd does not support an argument thus it just fails.

By pure accident, i was right that we need to update the inbuilt documentation because $roundd is documented with this example but it does acutally not take a 2nd parameter.
$roundd(number to round =number/%f_variable%[, number of output decimals = integer/%i_variable%])
:D
Thanks so much guys. It does work! :)