Bug with Mod?

Bug with Mod? - Сообщения

#1 Опубликовано: 01.01.2021 11:11:36
overlord

overlord

547 сообщений из 1330 понравились пользователям.

Группа: Moderator

I had encountered a strange behavior while trying to implement Tupper Formula.
Is this a bug or SMath shouldn't calculate modular of such a long number?
Sorry for very big picture but don't know how to show it in here else.
Build 0.99.7666 on Linux, same result with previous old builds by the way.

Regards

tupper.sm (4 КиБ) скачан 24 раз(а).

2021-01-01_17-10.png
#2 Опубликовано: 01.01.2021 13:54:02
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: Moderator

SMath doesn't have exact integer arithmetics. Numbers are handled as floats with finite precision. You will find that k+1=k evaluates to true. If you want to do exact integer arithmetics, Unfortunately, you can't even use CAS plugins like maxima or maple because any input is handled by SMath first before conveying it to the plugin. This includes downgrading of numeric constants to IEEE 754 floats.

Maxima has a mechanism of using string input to circumvent this but this will look extremly ugly in the SMath sheet.

tupper_kr.sm (4 КиБ) скачан 24 раз(а).
2021-01-01 17_52_19-SMath Studio - [tupper.sm_].png
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#3 Опубликовано: 01.01.2021 19:20:14
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

Is this a bug or SMath shouldn't calculate modular of such a long number?


"modular" ... you mean 'mod'
Write ... mod(k,1.23456789)
Write ... mod(k,123456789.987654321)
#4 Опубликовано: 02.01.2021 10:51:59
overlord

overlord

547 сообщений из 1330 понравились пользователям.

Группа: Moderator

Wrote

SMath doesn't have exact integer arithmetics. Numbers are handled as floats with finite precision.


Thanks Martin, I figured so.
This is why there is a question, "bug or not".
Clearly it is not a bug but how SMath works.

Regards


#5 Опубликовано: 02.01.2021 20:08:42
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

This is why there is a question, "bug or not".


Nothing new here. I posted the attached long time ago, no answer.
Too big numbers chokes Smath.

Critical error.sm (2 КиБ) скачан 21 раз(а).
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений