problem with floats

Pondering the philosophy behind the language

problem with floats

Postby 0x69 » Mon May 13, 2019 12:04 pm

Hi,

When I try to execute
Code: Select all
(+ 1.1 1.2)
I get error:
ERR: value expected in function + : .1


NewLisp version is v.10.7.1 64-bit on Linux (Ubuntu 18.04.1 LTS) IPv4/6 UTF-8 libffi

What's the problem here with floats and how to fix it ?
0x69
 
Posts: 4
Joined: Sun Jul 25, 2010 9:27 am

Re: problem with floats

Postby HPW » Mon May 13, 2019 12:42 pm

Hello,

Take a look at your locale with (set-locale).

This sets the locale to german with , as decimal seperator:
(set-locale "de_DE")

And note that + is for integer-math. Use (add ... ...) for floats.

And the doc has good explanations for that. ;-)

Regards
Hans-Peter
HPW
 
Posts: 1375
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany


Return to Whither newLISP?

Who is online

Users browsing this forum: No registered users and 1 guest

cron