Login Page - Create Account

Support Board


Date/Time: Wed, 15 Jan 2025 11:48:46 +0000



Post From: Question About Float Precision in Sierra Chart API(ACSIL)

[2024-08-13 22:03:26]
User856649 - Posts: 5

There is nothing for us to state regarding this. What you are referring to is a well known issue with floating point numbers and programmers have been working around it for many years. This is just something you need to deal with.
for sure, yes, there are numerous ways/libraries to prevent the inaccuracy of native float number calculation in my study/DLL programming, but when i pass the result to SC, will it lose any precision? i cannot find the answer in your documents, which is why i ask the question here.
for example, i use the price data (i assume they are 100% accuracy), and convert them to decimal floating-point numbers and perform calculation to ensure the precision on calculation stage. once i get the calculation result, i pass the number(s) to e.g sc.Subgraph[].Data[] / sc.Subgraph[][]. based on the doc, this is a Array of float variables (SCFloatArray). my question here is what type float it is? native (binary)float? or a customized decimal float? I don't know. any guidance on your website? as far as i know -- no.
if it is a native float, then once i pass the number to the array, it losses precision immediately.
if it is not, then what kind of customized decimal floating-point type you are using, how can i convert my decimal to meet your decimal? in the example of sc.Subgraph[].Data[] / sc.Subgraph[][] part, it only shows this "sc.Subgraph[2][sc.Index] = 12.5f; "