Bug with Mod?

Bug with Mod? - Poruke

#1 Objavljeno: 1. 1. 2021. 11:11:36
overlord

overlord

601 svidjanja u 1.382 postova.

Grupa: 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,99 KiB) preuzeto 1501 put(ova).

2021-01-01_17-10.png
#2 Objavljeno: 1. 1. 2021. 13:54:02
Martin Kraska

Martin Kraska

1.369 svidjanja u 2.283 postova.

Grupa: 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,59 KiB) preuzeto 1566 put(ova).
2021-01-01 17_52_19-SMath Studio - [tupper.sm_].png
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
#3 Objavljeno: 1. 1. 2021. 19:20:14
Jean Giraud

Jean Giraud

983 svidjanja u 6.866 postova.

Grupa: 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 Objavljeno: 2. 1. 2021. 10:51:59
overlord

overlord

601 svidjanja u 1.382 postova.

Grupa: 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 Objavljeno: 2. 1. 2021. 20:08:42
Jean Giraud

Jean Giraud

983 svidjanja u 6.866 postova.

Grupa: 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,29 KiB) preuzeto 1536 put(ova).
  • Novi postovi
  • Nema novih postova