Currency compare different between 2.6.4 and 3.0.0 on Raspian lazarus / 66-Unix ---------------------------------------------------------------------- kristakis · 2018-08-23 02:45 Hi, I had an issue with a comparison of two currency values after upgrading from fpc 2.6.4 to 3.0.0. I had a look around but couldn't find anything about it. It could be related to how I'm using Abs() but I thought I'd post it here in case it really is a bug. Here's my code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program quicktest;{$MODE OBJFPC}{$H+}uses    classes, sysutils, baseunix, crt;var    a: currency;    b: currency;begin    a := -6;    b := 9.6;    if b < Abs(a) then         writeln('this is madness!')     else       writeln('sanity prevails.');    // bonus round    writeln(IntToStr(Length('¥')));    writeln(IntToStr(Length('$')));end.  When I compile that on fpc 2.6.4 it works and sanity prevails. When I compile it on fpc 3.0.0 there is madness. I have 2.6.4 on Raspbian Jessie and 3.0.0 on Raspbian Stretch but when I copy the 2.6.4 executable over to Stretch it works. Also I noticed that the Yen symbol has a length of 2 while Dollar is only 1. This happens in 2.6.4 and 3.0.0. Maybe all these are fixed in 3.0.4, I am investigating how to install that now. If not then I'll flip back to the 2.6.4 environment. thanks. kris ---------------------------------------------------------------------- lucamar · 2018-08-23 03:24 I can't help you regarding the problem with abs() but about this: Quote from: kristakis on August 23, 2018, 04:45:17 amAlso I noticed that the Yen symbol has a length of 2 while Dollar is only 1. This happens in 2.6.4 and 3.0.0. that's most probably because your source is UTF-8. Unicode places the $ in the ASCII group (Ux32..Ux126), while the yen symbol (as all other monetary symbols) is in a higher code group which means UTF-8 needs more than one byte to code it. Remember than Length() returns the lenght in bytes of its argument. ----- Incidentally ... FPC 3.0.0 is (relatively) old; lots of fixes were done up to the latest stable version 3.0.4 --- and even more up to 3.2.0 which is coming Really Soon(tm). ---------------------------------------------------------------------- Handoko · 2018-08-23 03:29 @kristakis I copied/pasted your code and tested on FPC 3.0.4 Linux, I got correct result: "sanity prevails." ---------------------------------------------------------------------- balazsszekely · 2018-08-23 04:16 Works here too with 3.0.4 ---------------------------------------------------------------------- kristakis · 2018-08-23 05:01 @lucamar Thanks for the info, I had the suspicion just after submitting that it might be a unicode thing. @all Good to hear it's been fixed. I'll need to work on getting 3.0.4 installed on the Pi. thanks, kris ---------------------------------------------------------------------- Thaddy · 2018-08-23 13:27 Quote from: kristakis on August 23, 2018, 04:45:17 am Maybe all these are fixed in 3.0.4, I am investigating how to install that now. If not then I'll flip back to the 2.6.4 environment. thanks. kris 3.0.4 is in stretch-backports simply add that to /etc/apt/sources.list and use sudo apt-get -t fpc to install (must use -t parameter) ---------------------------------------------------------------------- valdir.marcos · 2018-08-23 16:34 Quote from: Thaddy on August 23, 2018, 03:27:47 pm3.0.4 is in stretch- backports simply add that to /etc/apt/sources.list and use sudo apt-get -t fpc to install (must use -t parameter)The complete command is: sudo apt-get -t stretch-backports fpc But not so simply, you need to set Apt-Pinning: Apt-Pinning for Beginners https://jaqque.sbih.org/kplug/apt-pinning.html ---------------------------------------------------------------------- Thaddy · 2018-08-23 19:12 Quote from: valdir.marcos on August 23, 2018, 06:34:13 pmBut not so simply, you need to set Apt-Pinning: Apt-Pinning for Beginners https://jaqque.sbih.org/kplug/apt-pinning.html I didn't use apt-pinning here. It was not necessary. It's backports, not unstable.