Welcome to %s forums

BrainModular Users Forum

Login Register

Round Vs. Trunc

I need help on a Patch
Post Reply
sephult
Member
Posts: 1144
Contact:

Unread post by sephult » 21 Jul 2013, 16:32

Curious how Round vs. Trunc work?

So far I see the same results, I was expecting Trunc to allow me specify the precision at which I wanted to drop....

I think this is a feature request, or possibly if someone can fill me in on an easy method to drop precision to the place.


-S
"Every act of creation is first an act of destruction." -Picasso

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 21 Jul 2013, 16:58

Remember that each module has its own wiki page..click on the ?, you'll find your answer... ;-)

sephult
Member
Posts: 1144
Contact:

Unread post by sephult » 21 Jul 2013, 17:25

Thanks Nay, I guess I am looking more how to drop/truncate more precision in the decimal place for experimenting.
I havent dug to deep in experimenting with Round/Trunc.

Always appreciated!

-S
"Every act of creation is first an act of destruction." -Picasso

sephult
Member
Posts: 1144
Contact:

Unread post by sephult » 21 Jul 2013, 17:28

Okay I tested and saw the expected results using a constant.
Left me curious about constants though...I set constant to 12.85 and in the parameters it automatically sets = 12.8500003814697

This leaves me curious.
"Every act of creation is first an act of destruction." -Picasso

Thomas Helzle
Member
Posts: 334
Location: Berlin
Contact:

Unread post by Thomas Helzle » 21 Jul 2013, 19:31

Yeah, that is something rather irritating in Usine - float values change, even if very clear values are used that should normally be represented without precision problems like your example.
I don't know if there are internal processed doing something to the values that causes this.
Although it's more a cosmetic problem most of the time, it feels wrong ;-)

Cheers,

Tom

martignasse
Site Admin
Posts: 611
Location: Lyon, FRANCE
Contact:

Unread post by martignasse » 22 Jul 2013, 10:20

sephult wrote:Okay I tested and saw the expected results using a constant.
Left me curious about constants though...I set constant to 12.85 and in the parameters it automatically sets = 12.8500003814697
This leaves me curious.
Thomas Helzle wrote:Yeah, that is something rather irritating in Usine - float values change, even if very clear values are used that should normally be represented without precision problems like your example.
it's because it's stored internally in a float variable.
in usine, for design and performance choice, all dataflow event are stored as float at some point in the engine.

it's hard to explain without deep math (search 'Single-precision floating-point' in google), but a float can represent exactly a number only if it's a power of 2.
anyway, it's an universal limitation in computer science and despite the fact it seem strange to have this king of vagueness, it work pretty well except in very specific case.
Thomas Helzle wrote:I don't know if there are internal processed doing something to the values that causes this.
Although it's more a cosmetic problem most of the time, it feels wrong ;-)
it's not an internal process but the way values are stored, maybe in other soft they do cosmetics or store values differently...
but i can assure you that the cost to resolve this is hardly compatible with efficiency in a 'real time' point of view
Martin FLEURENT - Usine Developer - SDK maintainer

sephult
Member
Posts: 1144
Contact:

Unread post by sephult » 22 Jul 2013, 11:29

Thanks! I do understand differences in variable types....I just didn't realize that the constants were being stored as float.
I am guilty for not always going to the wiki, still getting used to that. I did however this time and saw....
Constant
Constant value.
out
Value of the constant
So I became very confused :lol:
Maybe we should update this to say it is stored as a Float value, and will display as such?

Thanks Thomas/Marignasse!
"Every act of creation is first an act of destruction." -Picasso

joffo78
Member
Posts: 1033
Contact:

Unread post by joffo78 » 22 Jul 2013, 13:16

Hello.
With this patch
You would choose between trunc or round and which decimal you want to keep (how many numbers after float).

Thomas Helzle
Member
Posts: 334
Location: Berlin
Contact:

Unread post by Thomas Helzle » 22 Jul 2013, 16:06

Yeah, as I said it's more a cosmetic issue.
And a reminder that what we nowadays think of as the ultimate in numeric precision is in fact the opposite:
Always slightly "wrong", even if negligible ;-)

Cheers,

Tom

sephult
Member
Posts: 1144
Contact:

Unread post by sephult » 23 Jul 2013, 00:14

Thanks for the patch share joffo ....much appreciated!
"Every act of creation is first an act of destruction." -Picasso

Post Reply

Who is online

Users browsing this forum: No registered users and 131 guests