Dear list, how can one limit the amount of digits of the decimal fraction in the number object? To have instead of 33.3333 only 2 digits after the colon 33.33.
Sorry for the newbie Q,
Popesz
if you really want to round the number itself to 2 digits after the comma you can do: *input* -> [* 100] -> [expr round($f1)] -> [* 0.01] -> *output* if you just want to limit the precision for printing purposes, you can do: *input* -> [makefilename %.2f] -> *output* (see http://www.cplusplus.com/reference/cstdio/printf/)
Christof
Gesendet: Dienstag, 31. Juli 2018 um 20:35 Uhr Von: "Csaba Láng" langcsaba@gmail.com An: Pd-List pd-list@lists.iem.at Betreff: [PD] decimal fraction limit
Dear list, how can one limit the amount of digits of the decimal fraction in the number object? To have instead of 33.3333 only 2 digits after the colon 33.33. Sorry for the newbie Q, Popesz_______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Gents,
both solutions are the same and the same perfectly works. Thanks, no more newbie questions, just expressions. Best, Popesz
On Tue, Jul 31, 2018 at 9:25 PM Christof Ressi christof.ressi@gmx.at wrote:
if you really want to round the number itself to 2 digits after the comma you can do:
*input* -> [* 100] -> [expr round($f1)] -> [* 0.01] -> *output*
if you just want to limit the precision for printing purposes, you can do:
*input* -> [makefilename %.2f] -> *output*
(see http://www.cplusplus.com/reference/cstdio/printf/)
Christof
Gesendet: Dienstag, 31. Juli 2018 um 20:35 Uhr Von: "Csaba Láng" langcsaba@gmail.com An: Pd-List pd-list@lists.iem.at Betreff: [PD] decimal fraction limit
Dear list, how can one limit the amount of digits of the decimal fraction in the number object? To have instead of 33.3333 only 2 digits after the colon 33.33.
Sorry for the newbie Q,
Popesz_______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
both solutions are the same
well, not quite ;-) the first one will give you a number, the second will give you a symbol.
Christof
Gesendet: Dienstag, 31. Juli 2018 um 21:58 Uhr Von: "Csaba Láng" langcsaba@gmail.com An: Pd-List pd-list@lists.iem.at Betreff: Re: [PD] decimal fraction limit
Gents, both solutions are the same and the same perfectly works. Thanks, no more newbie questions, just expressions. Best, Popesz
On Tue, Jul 31, 2018 at 9:25 PM Christof Ressi <christof.ressi@gmx.at[mailto:christof.ressi@gmx.at]> wrote:if you really want to round the number itself to 2 digits after the comma you can do: *input* -> [* 100] -> [expr round($f1)] -> [* 0.01] -> *output* if you just want to limit the precision for printing purposes, you can do: *input* -> [makefilename %.2f] -> *output* (see http://www.cplusplus.com/reference/cstdio/printf/%5Bhttp://www.cplusplus.com...])
Christof
Gesendet: Dienstag, 31. Juli 2018 um 20:35 Uhr Von: "Csaba Láng" <langcsaba@gmail.com[mailto:langcsaba@gmail.com]> An: Pd-List <pd-list@lists.iem.at[mailto:pd-list@lists.iem.at]> Betreff: [PD] decimal fraction limit
Dear list, how can one limit the amount of digits of the decimal fraction in the number object? To have instead of 33.3333 only 2 digits after the colon 33.33. Sorry for the newbie Q, Popesz_______________________________________________ Pd-list@lists.iem.at[mailto:Pd-list@lists.iem.at] mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list%5Bhttps://lists.puredata.info/l... Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list%5Bhttps://lists.puredata.info/l...]