Question

I installed gnu small talk in my Mac using port.

sudo port install gst

The version is 3.2.5

gst -v
GNU Smalltalk version 3.2.5
Copyright 2009 Free Software Foundation, Inc.
Written by Steve Byrne (sbb@gnu.org) and Paolo Bonzini (bonzini@gnu.org)

It seems to be working fine, but when I tested floating point number, I got divide by zero error message.

st> 123.323
Object: 1 error: The program attempted to divide a number by zero
ZeroDivide(Exception)>>signal (ExcHandling.st:254)
SmallInteger(Number)>>zeroDivide (SysExcept.st:1426)
Fraction>>setNumerator:setDenominator: (Fraction.st:485)
Fraction class>>numerator:denominator: (Fraction.st:66)
Fraction>>- (Fraction.st:151)
FloatD(Float)>>printOn:special: (Float.st:533)
FloatD(Float)>>printOn: (Float.st:436)
FloatD(Object)>>printString (Object.st:534)
FloatD(Object)>>printNl (Object.st:571)
st> 

I could bypass this issue by attaching "e0".

st> 123.323e0
123.323

However, I still get an error with some numeric operations involving floating point numbers.

st> 1.1 sin
Object: 1 error: The program attempted to divide a number by zero
ZeroDivide(Exception)>>signal (ExcHandling.st:254)

Sometimes it works fine.

st> 3.14 sin
0.0016

What's wrong with this?

Was it helpful?

Solution 2

I guess I need to attach e0 to all the floating point numbers.

st> 1.1e0 sin
0.8912074

Or even with just e only

st> 1.1e sin
0.8912074

OTHER TIPS

According to a thread in a Smalltalk forum, this problem is caused by gst compiled with the -pie option, which is the default in many Linux distros, and maybe in Mac port too.

To solve this problem, compile gst with -no-pie option: Download gst 3.2.5 from https://ftp.gnu.org/gnu/smalltalk/, extract the tarball, and then compile & install

export CFLAGS='-no-pie'
export LDFLAGS='-no-pie'
./configure
make
sudo make install

This solution works fine on my Linux Mint PC.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top