Calculation problem lazarus / 34-Windows ---------------------------------------------------------------------- o002str · 2022-04-13 16:02 Hello, my name is Huib van Straaten and I am 72 years old. To keep my brain fit, I started teaching myself programming in Lazarus/FreePascal. Because I only have a good command of Dutch, I use Google translate to translate my question into English. My challenge is to write a tax program, in which I want to be able to calculate in advance what the best options are to pay as little tax as possible, or to receive as much tax back as possible. Now my problem. Depending on whether I use my desktop (with Linux as OS) or my laptop (Windows 11), I run into the following problem when testing the program. When I test a calculation under Linux, I have to change a decimal comma (as is usual here in the Netherlands) to a point (as is usual in the USA). When I test the same calculation under Windows, I have to change the decimal point to a comma. My question now is, is it possible to consult the operating system with the help of a function (which I cannot find) which notation (point or comma) is used to perform a calculation with decimals? Then I can write a function myself, with which I no longer have to worry about which operating system my program is running under. After 1.5 months of searching the internet, I have given up the courage to search further and I ask for help with this. Thank you in advance for a response. Kind regards, Huib ---------------------------------------------------------------------- Sieben · 2022-04-13 16:24 There is a global var in FPC/Lazarus called DefaultFormatSettings which, aside from other settings for formatting date or time display etc, also holds information about the DecimalSeparator. From your description I guess that your program does not adopt to the system settings on Linux, as they should be the same on both Windows and Linux, presuming both are configured to dutch standard. You can change this by adding the unit cLocale to the uses clause of eg your main form or *.lpr file. Having done this your code should work the same on both systems. ---------------------------------------------------------------------- Bart · 2022-04-13 18:36 A better option might be to use the conversion routines (string to number conversion) that accept a TFormatSettings parameter. 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 uses  SysUtils;var  S: String;  FS: TFormatSettings;  D: Double;begin  FS.DecimalSeparator := ',';  //when in the Netherlands, go Dutch  S := '1,25';  D := StrToFloat('1,23', FS);end. Notice that when you set DefaultFotmatSettings.DecimalSeparator := ',' you may be in for a surprise on Windows. Art some poit Windows may send a message that system wide settings for some formatsetting hase been changed (or may have been changed), and at that point your DefaultFormatSetting.DecimalSpearator will be reset to what Windows decides it should be. (In a Lazarus GUI application, you can disable this Windows feature using Application.UpdateFormatSettings := False;  ) B.t.w. The NL Delphi Forum also has a section for Lazarus/Freepascal. And general programming questions about Pascal can be asked there too (in Dutch). Bart ---------------------------------------------------------------------- Sieben · 2022-04-13 20:14 The point I was trying to make is that in order to 'go Dutch' on a dutch Linux, you just need to include cLocale. I'd suggest doing it in the *.lpr file like this for example: 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 MyProg; {$mode objfpc}{$H+} uses  {$IFDEF UNIX}  cThreads,  cLocale,  {$ENDIF}  Interfaces, Forms, // etc... ---------------------------------------------------------------------- o002str · 2022-04-14 15:00 Translated by Google Translate Dear Sieben and Bart, Thanks for your quick response and I'll try your suggestions tonight. I will let you know the result as soon as possible. It may sound strange, but I have set openSuze (just like Windows) as Dutch. Still, I have to count on a point there. Huib ---------------------------------------------------------------------- o002str · 2022-04-20 15:09 Translated with Google Translate Sorry for my late response. My wife had invited the children and grandchildren for Easter over for dinner. Now the preparations for that dinner (also for me) took some time. Afterwards our 2 granddaughters stayed overnight. So there was no time left to try anything out. I just tried the cLocale option for the first time and it works great. And because I'm a lazy programmer (why do 10 keystrokes, when you can get the same result with 5), I haven't tried the other option given. Since I will be printing the results of my tax calculations shortly, I will no doubt want to call on you again. But first I want to find out for myself how that printing works. My immense thanks for your quick response.