[x3d-public] Using c# with graphics

Konstantin Smirnov konstantin.e.smirnov at gmail.com
Tue Sep 21 09:07:10 PDT 2021


When we use Visual Studio, can we get some tips for this, must we write
some special tricks for Double?
Decimal is better?

вт, 21 сент. 2021 г., 17:36 Konstantin Smirnov <
konstantin.e.smirnov at gmail.com>:

> By the way, can we get guaranteed accuracy of math computations, also
> sums, division get 16 digit true?
>
> вт, 21 сент. 2021 г., 16:45 Konstantin Smirnov <
> konstantin.e.smirnov at gmail.com>:
>
>> Now taking part in a contest, want to understand, is this simple?
>> Most examples sum numbers simply
>>
>> вт, 21 сент. 2021 г., 16:39 Konstantin Smirnov <
>> konstantin.e.smirnov at gmail.com>:
>>
>>> It seems to me that we must not do additional operations on each calc
>>> Examples don't have this
>>>
>>> вт, 21 сент. 2021 г., 13:39 vmarchetti at kshell.com <vmarchetti at kshell.com
>>> >:
>>>
>>>> This reference:
>>>> https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types
>>>> details that in the Microsoft .NET C# environment, the numeric double
>>>> type is an 8-byte representation, and offers about 16 digits of precision.
>>>>
>>>> In my experience, in those specific cases where numeric precision needs
>>>> to be carefully dealt with, the solution is not to round the results of a
>>>> calculation; rather the solution is to look at where two double values are
>>>> being compared for equality, and replacing the comparison
>>>>
>>>> if ( a==b) { .... }
>>>>
>>>> with
>>>> if ( abs(a-b) < tolerance ) { ... }
>>>>
>>>> and choosing a value of tolerance is can be something like
>>>>
>>>> double tolerance = 1.0e-15 * Math.Max( abs(a), abs(b))
>>>>
>>>> Vince Marchetti
>>>>
>>>>
>>>> On Sep 21, 2021, at 1:04 AM, Konstantin Smirnov <
>>>> konstantin.e.smirnov at gmail.com> wrote:
>>>>
>>>> Hi
>>>> When adding double numbers in .cs script, must we think about every
>>>> digit accuracy, or it's approximate numbers, so we can treat them as
>>>> approximate with e-7, or so? 15?
>>>>
>>>> Can we do calc and round afterwards?
>>>> _______________________________________________
>>>> x3d-public mailing list
>>>> x3d-public at web3d.org
>>>> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>>>>
>>>>
>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20210921/9bc9a7f4/attachment.html>


More information about the x3d-public mailing list