Support Board
Date/Time: Thu, 16 Jan 2025 00:12:06 +0000
Sierra adding extra digits to double in arrays
View Count: 1321
[2017-09-30 19:52:18] |
michelh - Posts: 159 |
Hi Sierra, My developer is translating some code from meta trader to sierra. We are having some issues with double elements of arrays. When we input doubles into the array with say 5 decimal places, debugging showed that Sierra is adding extra digits up to the 16 decimal places in the variable. Over many iterations in the loop, this is introducing errors such that the output is different from the meta-trader code used for the conversion. This is occurring despite proper variable initialization. Is there a solution to this? I looked in the ASCIL and found information on the sc.valueformat but I understand this to be related to how a subgraph is displayed and NOT pertaining to subgraph arrays used for calculation. Can you please help? Date Time Of Last Edit: 2017-09-30 19:59:58
|
[2017-10-01 01:55:24] |
Sierra Chart Engineering - Posts: 104368 |
When we input doubles into the array with say 5 decimal places, debugging showed that Sierra is adding extra digits up to the 16 decimal places in the variable. Not to be critical, but are they not aware that this is simply due to the IEEE floating-point number specification and what is known as floating-point error? They really should understand this. This function here explains more about this: sc.FormattedEvaluate() Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2017-10-01 21:15:51
|
To post a message in this thread, you need to log in with your Sierra Chart account: