bug-libmatheval
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-libmatheval] "reverse alphanumerical" variables optional featur


From: Joey
Subject: Re: [bug-libmatheval] "reverse alphanumerical" variables optional feature possible?
Date: Sat, 11 Jan 2014 18:12:28 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 01/09/2014 05:59 PM, Romain Garbi wrote:
Hi !

Le 09/01/2014 16:17, Joey a écrit :
On 01/09/2014 03:08 PM, darkbatcher wrote:
Hi !

Why the hell want you to use litterals beginning with numbers ? for
years, most programming language have forbiden symbols beginning with
numbers, i can't see the benefits of such a feature. To me, it is
nothing but a bad idea...

About the support of hexadecimal notation, i had though about adding
such features for my own project. But i realised that the support of
hexadecimal values (refering to "integer hexadecimal") wasn't
interesting since hexadecimal notation is only interesting if logical
and bitwise operation are available, and that does not make sense as
libmatheval is designed for floating point features...

Regards,
Romain GARBI

Hi,

Because string literals are easy to work with and easy to understand.
And as you may know, I'm talking about color values.
The hex rgb representation of the color /green/ would be 00 FF 00.
Naturally, this ends up with string literals beginning with a number.

My program is not a programming language. My thoughts were simply, if
00FF00 can not be a valid value, why not just regard
it as a variable instead of a segfault?

Is libmatheval designed solely on floating point?


Hi !

The fact was that I didn't realised what you wanted. I just said it doesn't seemed to be a good idea to use symbols begining with numbers, but it can however easily be achieved.

And yes, libmatheval is only based on floating point arithmetic, it just provides operations and function for floating numbers. Moreover, adding integer arithmetic (ie. logical and bitwise operations) does not make sense for floating numbers (as floating numbers are not represented by an obvious bit sequence) and would make the code bigger and harder to maintain. This is indeed against the *NIX philosophy, a program shall do only one thing, but do it the best possible. It can be sum up by "keep it simple".

I was confronted to this problem some time ago for an interpreter that must handle both integers and floats. I found that extending libmatheval for doing that wasn't interesting and far to hard. So I decided to create my own library for handling only integers. You can find it there : http://sourceforge.net/p/dos9/code/ci/master/tree/ (have a look on libinteval directory). You might need to change the Makefile if you want to build it.

regards,
Romain

Hi Romain,

Interesting project.
I'm all for the UNIX philosphy so that's why for now i have decided to completely drop libmatheval in that part of my program and replace it with a simple improvised parser. I'm working mostly with string literals and floats at the moment (0.0 - 1.0), so I was not entirely looking for an integer alternative, but it's true what you said about integer arithmetic vs floating point arithmetic.

Thanks,

Joey



reply via email to

[Prev in Thread] Current Thread [Next in Thread]