Problem with the array

Problem with the array - Messaggi

#1 Pubblicato: 26/08/2021 05:32:35
Vasia

Vasia

0 apprezzamenti in 17 post.

Gruppo: User

Столкнулся с такой проблемой:
Есть зависимость переменной А от диапазона чисел λ = [0.3, 0.31,...1.3].
При λ = 0.7 должно выводиться в массиве А = 0, но вместо этого почему-то А = 5.40901*10^{-18}.
Попробовал уменьшить диапазон λ = [0,6, 0,61,...1.3], тогда А = 0.
Что не так у меня? File non trovato.File non trovato.File non trovato.File non trovato.
#2 Pubblicato: 26/08/2021 11:30:40
overlord

overlord

600 apprezzamenti in 1.381 post.

Gruppo: Moderator

Wrote

Столкнулся с такой проблемой:
Есть зависимость переменной А от диапазона чисел λ = [0.3, 0.31,...1.3].
При λ = 0.7 должно выводиться в массиве А = 0, но вместо этого почему-то А = 5.40901*10^{-18}.
Попробовал уменьшить диапазон λ = [0,6, 0,61,...1.3], тогда А = 0.
Что не так у меня?


This is because electronics, how computers store numbers.
SMath assign numbers to variables as an internal rational representation.
10^-18 is considered zero for SMath, even if it is not zero.
I have written about this issue sometime ago. This is not a bug however.
You can add an additional calculation check to your function in order to prevent this.

Regards

massiv_r1.sm (32 KiB) scaricato 1175 volta(e).
#3 Pubblicato: 27/08/2021 02:32:56
Vasia

Vasia

0 apprezzamenti in 17 post.

Gruppo: User

Wrote

Wrote

Столкнулся с такой проблемой:
Есть зависимость переменной А от диапазона чисел λ = [0.3, 0.31,...1.3].
При λ = 0.7 должно выводиться в массиве А = 0, но вместо этого почему-то А = 5.40901*10^{-18}.
Попробовал уменьшить диапазон λ = [0,6, 0,61,...1.3], тогда А = 0.
Что не так у меня?


This is because electronics, how computers store numbers.
SMath assign numbers to variables as an internal rational representation.
10^-18 is considered zero for SMath, even if it is not zero.
I have written about this issue sometime ago. This is not a bug however.
You can add an additional calculation check to your function in order to prevent this.

Regards

massiv_r1.sm (32 KiB) scaricato 1175 volta(e).



Спасибо, а не составит труда кинуть ссылку на тему, где Вы об этом писали?
#4 Pubblicato: 27/08/2021 07:32:25
overlord

overlord

600 apprezzamenti in 1.381 post.

Gruppo: Moderator

Wrote

Спасибо, а не составит труда кинуть ссылку на тему, где Вы об этом писали?


Look for Razonar's answers in this topic.

Regards.

https://en.smath.com/forum/yaf_postst20177_Equality.aspx
  • Nuovi post
  • Nessun nuovo post