|
Post by rikky on Dec 7, 2019 19:33:45 GMT 1
Hello. I don't know if this is a bug, or if it is considered normal behaviour. If I do : the response is zero, as I was expecting. idem VAL("abc123") is also zero. So In my logic, I thought that VAL("123ABC") would be zero as well. Surprisingly, it responds to 123 If this is considered as normal behaviour, then I appologize for writing this post. Rik.
|
|
|
Post by Pjot on Dec 8, 2019 8:51:58 GMT 1
Hi rikky, Thanks for your report. The VAL function is mapped to the C function atof() directly. As the man page says: So the behavior you observe is correct, it would have been the same when you would code in C directly.
It may look confusing, but it is a direct consequence of one of the design principles of BaCon where expressions and functions are passed as-they-are to the C compiler as much as possible (lazy conversion). On the other hand, we can use this behavior to our advantage. For example, when we need the value portion of an amount of money: PRINT VAL("5.24€")
No need to chop off the €-symbol here Best regards Peter
|
|
|
Post by rikky on Dec 8, 2019 15:56:44 GMT 1
Aha, I guess I've become too eager to find bugs. But there aren't many bugs anymore It's a pity. Maybe it's a good idea, to hide an intentional bug in the next release. Like an easter egg. Just to please your users. Anyway, Thanks for making BaCon so simple, professional and aparently bug-free. Now even someone like me can compete with the professionals, with their sophisticated and incredebly complex languages. Rik.
|
|
|
Post by Pjot on Dec 9, 2019 7:37:34 GMT 1
Maybe it's a good idea, to hide an intentional bug in the next release. Like an easter egg. Just to please your users. Well, I will think about it But I do not think there is such thing as bug-free software in this world. So please keep posting anything you think is not correct! Best regards Peter
|
|