#### Damien.darhk

##### Member

- Joined
- Aug 13, 2021

- Messages
- 8

- Programming Experience
- 3-5

Hello, I've an array of bytes that contains Y values of a chart; I need to calculate the angles between each point, so:

Dim numbers = New Byte() {&H0, &H0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &H0, &H0, &H0, &H1, &HA8, &H1, &H2C, &H0, &HEA, &H0, &HCB, &H0, &HC4, &H0, &HBE, &H0, &HB7, &H0, &HB5, &H0, &HB2, &H0, &HB0, &H0, &HAE, &H0, &HAC, &H0, &HAB, &H0, &HAA, &H0, &H0, &H0, &H0, &H2, &HC, &H1, &H72, &H1, &H2A, &H0, &HFF, &H0, &HED, &H0, &HE3, &H0, &HDB, &H0, &HD5, &H0, &HD1, &H0, &HCE, &H0, &HCB, &H0, &HC8, &H0, &HC4, &H0, &HBD, &H0, &H0, &H0, &H0, &H2, &H87, &H1, &HCA, &H1, &H59, &H1, &H34, &H1, &H1D, &H1, &H15, &H1, &HC, &H1, &H6, &H1, &H3, &H1, &H2, &H1, &H0, &H0, &HFE, &H0, &HFA, &H0, &HF2, &H0, &H0, &H0, &H0, &H3, &H17, &H2, &H30, &H1, &HBA, &H1, &H65, &H1, &H46, &H1, &H38, &H1, &H2E, &H1, &H25, &H1, &H22, &H1, &H1D, &H1, &H18, &H1, &H15, &H1, &HF, &H1, &H6, &H0, &H0, &H0, &H0, &H3, &H99, &H2, &H8B, &H1, &HF3, &H1, &HAB, &H1, &H72, &H1, &H53, &H1, &H43, &H1, &H36, &H1, &H2F, &H1, &H2B, &H1, &H28, &H1, &H22, &H1, &H1B} 'This is the array of points

Dim angleslist As New List(Of Double)

For i = 1 To numbers.Count - 1

angleslist.Add(Math.Atan2(numbers(i) - numbers(i - 1), 1))

Next

but I get System.OverflowException.

I'm missing something?

Dim numbers = New Byte() {&H0, &H0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &HA0, &H0, &H0, &H0, &H0, &H1, &HA8, &H1, &H2C, &H0, &HEA, &H0, &HCB, &H0, &HC4, &H0, &HBE, &H0, &HB7, &H0, &HB5, &H0, &HB2, &H0, &HB0, &H0, &HAE, &H0, &HAC, &H0, &HAB, &H0, &HAA, &H0, &H0, &H0, &H0, &H2, &HC, &H1, &H72, &H1, &H2A, &H0, &HFF, &H0, &HED, &H0, &HE3, &H0, &HDB, &H0, &HD5, &H0, &HD1, &H0, &HCE, &H0, &HCB, &H0, &HC8, &H0, &HC4, &H0, &HBD, &H0, &H0, &H0, &H0, &H2, &H87, &H1, &HCA, &H1, &H59, &H1, &H34, &H1, &H1D, &H1, &H15, &H1, &HC, &H1, &H6, &H1, &H3, &H1, &H2, &H1, &H0, &H0, &HFE, &H0, &HFA, &H0, &HF2, &H0, &H0, &H0, &H0, &H3, &H17, &H2, &H30, &H1, &HBA, &H1, &H65, &H1, &H46, &H1, &H38, &H1, &H2E, &H1, &H25, &H1, &H22, &H1, &H1D, &H1, &H18, &H1, &H15, &H1, &HF, &H1, &H6, &H0, &H0, &H0, &H0, &H3, &H99, &H2, &H8B, &H1, &HF3, &H1, &HAB, &H1, &H72, &H1, &H53, &H1, &H43, &H1, &H36, &H1, &H2F, &H1, &H2B, &H1, &H28, &H1, &H22, &H1, &H1B} 'This is the array of points

Dim angleslist As New List(Of Double)

For i = 1 To numbers.Count - 1

angleslist.Add(Math.Atan2(numbers(i) - numbers(i - 1), 1))

Next

but I get System.OverflowException.

I'm missing something?

Last edited: