Page 1 of 1

Slightly more precise like Ruby

PostPosted: Wed Jun 24, 2020 2:36 pm
by wlangfor@uoguelph.ca
It's really difficult to keep up with Ruby. Ruby's math is much more precise and here's a schematic that has an experiment showing that.

I've been trying to make something that is more accurate like Ruby with green; And in a small way I'm closer, but there's a margin of error.

Makes you want to study using sin and cosine with ruby:
https://www.geeksforgeeks.org/ruby-math-sin-function/#:~:text=The%20cos()%20is%20an,%5B-1%2C%20%2B1%5D.&text=Parameters%3A%20The%20function%20accepts%20one,Value%3A%20It%20returns%20the%20sine.

https://youtu.be/nQZNFPlxYeY

Download 1
https://vstplug.com/?download=1&kccpid=2033&kcccount=https://vstplug.com/wp-content/over%20precision%20V2.fsm

V3 has a fallback which falls back on the original sum if it cannot improve upon the figure's stability after math.

Download 2
https://vstplug.com/?download=1&kccpid=2033&kcccount=https://vstplug.com/wp-content/over%20precision%20V3%20-%20with%20fallback.fsm

Re: Slightly more precise like Ruby

PostPosted: Wed Jun 24, 2020 3:09 pm
by MichaelBenjamin
i think the thing that your schematic shows, is that you get different small floating accumulation errors, depending on the chain of calculation. the things you compare do vastly different chains. the difference in accumulated error is totally normal and nothing to worry about. also remember everytime you connect two lines to the same thing, it will end up in a (invisible) addition.
what ruby uses as default floating numbertype i don't know, could be double unless otherwise specified.

Re: Slightly more precise like Ruby

PostPosted: Wed Jun 24, 2020 4:03 pm
by wlangfor@uoguelph.ca
It had been My rationale also; not to worry, about the discrepancy, and to that end that maybe multiplication was better due to the inevitable lack of precision.

But seeing it, rather than conceiving it is something that in My mind makes Ruby something that becomes much more appealing. We often think about it for redraw and imagery and for graphics, but I know Myco uses ruby a lot for math. I guess I wasn't a believer until seeing the difference.

But of course, it comes down to CPU use, if less with green; it's very tempting.

EDIT: there is one instance however, where this phenomenon becomes a real problem; and that is, in the case of boolean checks. Like in the sense of comparing one versus the other to compare some condition and to satisfy some clause which makes this idea necessary in some senses for the simpler math that's perhaps even for interfaces and graphical components, in such cases where pixels are situated. Is Ruby something that should be re-iterated forever for each little bit of code? Not sure, maybe yes, maybe no.

Re: Slightly more precise like Ruby

PostPosted: Wed Jun 24, 2020 6:06 pm
by trogluddite
wlangfor@uoguelph.ca wrote:It's really difficult to keep up with Ruby. Ruby's math is much more precise

Yes, Ruby uses double-precision floats throughout (as you have already been told).
Green uses single precision, and you can't add precision without adding bits (as you have already been told).

You are simply re-iterating the exact same nonsensical theories about numeric precision as you have been on your many other similar threads. There is nothing further to say about the topic which myself, Chris, Michael, and other haven't already pointed out to you. You have also been pointed in the direction of comprehensive learning resources on this topic - in particular the documents relating to the IEEE754 standard.

[moderation="trog"]
Thread locked. I will give you one last chance - reasonable questions to help you understand floating-point arithmetic may be taken, but if you create any more threads about your nonsensical "precision-and-a-half alchemy", the consequences outlined in your final formal warning will be invoked.
[/moderation]