[closed]Variable Declaration Completion as Double lazarus / 9-Editor ---------------------------------------------------------------------- m.abudrais · 2019-05-02 06:32 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 procedure TForm1.Form1Create(Sender: TObject);begin  MyFloat:=3.1;end;when I press  ctrl +shift +c  MyFloat is declared as Extended, is there an option to change it to Double? ---------------------------------------------------------------------- Thaddy · 2019-05-02 08:47 Depends on your platform: if it is Windows 64 a double is the exact same as extended...... So more information is needed to give a correct answer... In general the resolution is chosen as the maximum available, though, for floats, whereas with integers the minimum is chosen. ---------------------------------------------------------------------- lucamar · 2019-05-02 10:31 Quote from: m.abudrais on May 02, 2019, 08:32:06 amCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Form1Create(Sender: TObject);begin  MyFloat:=3.1;end;when I press  ctrl +shift +c  MyFloat is declared as Extended, is there an option to change it to Double? Seems to be fixed: For FP values, Extended, for integers, Integer, etc. Even if you try something like: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  Big := 5000000000;which requires a 64 bit integer, completion declares Big as Integer (which in 32 bits, like here, is LongInt). ---------------------------------------------------------------------- m.abudrais · 2019-05-02 12:29 I use lazarus 2.0.2 32bit, but my OS is win7 64bit ---------------------------------------------------------------------- Thaddy · 2019-05-02 12:45 The 32 bit Windows Lazarus  should choose true extended (80 bits) instead of double...Even on a 64 bit Windows system... I can't test this, but that may be a bug.. (I have no 32 bit windows software installed since a very long time). If this is the case, report it against Lazarus IDE because the compiler does everything correct in your case. I am not aware of any options you asked for, as per my first answer. ---------------------------------------------------------------------- lucamar · 2019-05-02 13:06 Quote from: Thaddy on May 02, 2019, 02:45:15 pmThe 32 bit Windows Lazarus  should choose true extended (80 bits) instead of double...Even on a 64 bit Windows system... I can't test this, but that may be a bug.. (I have no 32 bit windows software installed since a very long time). If this is the case, report it against Lazarus IDE because the compiler does everything correct in your case. I am not aware of any options you asked for, as per my first answer. It does choose Extended which in 32 bits will be the true 80bit extended and in 64 bits will be an alias for Double, IIRC. What is "funny" (whether a bug or a simplistic view of the world) is completing as Integer a variable which is being assigned a value greater than MaxLongInt. My guess is that CodeTools looks to see whether it's a float; if it's it declares it as Extended, if not as Integer. ---------------------------------------------------------------------- Thaddy · 2019-05-02 13:21 Quote from: lucamar on May 02, 2019, 03:06:06 pmWhat is "funny" (whether a bug or a simplistic view of the world) That's a feature request.... Anyway, I fear you are right and it is a bug in CodeTools or the IDE. And quite likely what you implicitly describe..if you mean that the IDE seems to pick platform instead of compiler bitness 64 vs 32 which also means 64 fpu vs 80 bit fpu. ---------------------------------------------------------------------- m.abudrais · 2019-05-02 15:38 QuoteIt does choose Extended which in 32 bits will be the true 80bit extendedyes the SizeOf(MyFloat) is 10 thank you all. ---------------------------------------------------------------------- Thaddy · 2019-05-02 16:11 Plz mark as closed? ---------------------------------------------------------------------- lucamar · 2019-05-02 17:30 Quote from: Thaddy on May 02, 2019, 03:21:59 pmAnd quite likely what you implicitly describe..if you mean that the IDE seems to pick platform instead of compiler bitness 64 vs 32 which also means 64 fpu vs 80 bit fpu. I doesn't seem to pick much;  just a simple comparison of the style: Code: [Select]If ItLooksLikeANumber then   if ItLooksLikeFloatingPoint then     AddVarType(Extended)   else     AddVarType(Integer) Funnier yet, if you do: 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 procedure ThatsRight;var  test: Int64begin  i := 1 + test;end;It completes it as: var test, i: int64 but if you try: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 procedure ThatsRight;var  test: Int64begin  for i := 0 to test do;end;it completes i as: i: Integer; A bit squizophrenic, isn't it? ---------------------------------------------------------------------- Bart · 2019-05-02 20:56 Quote from: lucamar on May 02, 2019, 07:30:38 pmbut if you try: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 procedure ThatsRight;var  test: Int64begin  for i := 0 to test do;end;it completes i as: i: Integer; A bit squizophrenic, isn't it? No it's not. Loop variables must be ordinals. Int64 is not an ordinal (in that sense, at least for the compiler. It is documented), at least not on 32-bit. So declaring it as 32-bit integer (or 16-bit on DOS) is the safe thing to do. Bart ---------------------------------------------------------------------- m.abudrais · 2019-05-03 08:10 Quote from: Thaddy on May 02, 2019, 06:11:48 pmPlz mark as closed? done.