Max8 で小数点同士の乗算(かけ算)をする方法


Max8で*オブジェクトを使って小数値の乗算をする際に結果が丸められてしまうので、結果でも小数が出る方法を調べました。

*の横に1.と入力することで少数の乗算ができます。以下のソースをコピーしてMaxでペーストするとテストパッチが確認できます。

{ “boxes” : [ { “box” : { “maxclass” : “button”, “id” : “obj-9”, “numoutlets” : 1, “outlettype” : [ “bang” ], “patching_rect” : [ 186.0, 45.0, 24.0, 24.0 ], “numinlets” : 1, “parameter_enable” : 0 } } , { “box” : { “maxclass” : “newobj”, “text” : “* 1.”, “id” : “obj-7”, “numoutlets” : 1, “outlettype” : [ “float” ], “patching_rect” : [ 186.0, 158.0, 29.5, 22.0 ], “numinlets” : 2 } } , { “box” : { “maxclass” : “flonum”, “id” : “obj-6”, “numoutlets” : 2, “format” : 6, “outlettype” : [ “”, “bang” ], “patching_rect” : [ 186.0, 208.0, 108.0, 22.0 ], “numdecimalplaces” : 5, “numinlets” : 1, “parameter_enable” : 0 } } , { “box” : { “maxclass” : “flonum”, “id” : “obj-5”, “numoutlets” : 2, “format” : 6, “outlettype” : [ “”, “bang” ], “patching_rect” : [ 267.0, 82.0, 50.0, 22.0 ], “numinlets” : 1, “parameter_enable” : 0 } } , { “box” : { “maxclass” : “flonum”, “id” : “obj-2”, “numoutlets” : 2, “format” : 6, “outlettype” : [ “”, “bang” ], “patching_rect” : [ 186.0, 82.0, 50.0, 22.0 ], “numinlets” : 1, “parameter_enable” : 0 } } ], “lines” : [ { “patchline” : { “source” : [ “obj-2”, 0 ], “destination” : [ “obj-7”, 0 ] } } , { “patchline” : { “source” : [ “obj-5”, 0 ], “destination” : [ “obj-7”, 1 ], “order” : 0 } } , { “patchline” : { “source” : [ “obj-7”, 0 ], “destination” : [ “obj-6”, 0 ] } } , { “patchline” : { “source” : [ “obj-9”, 0 ], “destination” : [ “obj-2”, 0 ] } } , { “patchline” : { “source” : [ “obj-5”, 0 ], “destination” : [ “obj-9”, 0 ], “order” : 1 } } ], “appversion” : { “major” : 8, “minor” : 1, “revision” : 1, “architecture” : “x64”, “modernui” : 1 } , “classnamespace” : “box” }

また、少数の桁数はInspectorのAllの項目にあるNumber of Decimal Placesの数値を変えると設定できます。 (例)5にすると小数点第5位までになる

atnr.net の RSS登録はこちらから

コメントは受け付けていません。