Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline overlord  
#1 Posted : 01 January 2021 17:11:36(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,124
Turkey

Was thanked: 506 time(s) in 337 post(s)
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 (5kb) downloaded 8 time(s).

2021-01-01_17-10.png

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline mkraska  
#2 Posted : 01 January 2021 19:54:02(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,980
Germany

Was thanked: 1120 time(s) in 718 post(s)
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 (5kb) downloaded 5 time(s).
2021-01-01 17_52_19-SMath Studio - [tupper.sm_].png
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline Jean Giraud  
#3 Posted : 02 January 2021 01:20:14(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: overlord Go to Quoted Post
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)
Offline overlord  
#4 Posted : 02 January 2021 16:51:59(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,124
Turkey

Was thanked: 506 time(s) in 337 post(s)
Originally Posted by: mkraska Go to Quoted Post
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


Offline Jean Giraud  
#5 Posted : 03 January 2021 02:08:42(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: overlord Go to Quoted Post
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 (3kb) downloaded 6 time(s).
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.