The problem is the following, I am currently developing a console application which adds two decimal numbers (Numbers of type double), these numbers are received by keyboard. But when doing the calculation, it shows me as a result a number in exp (I think that's what it calls ) and I don't want it to appear that way. I want it to be this way, for example, if we add 2.5 + 3 = 5.5, that is, I show the results as the Windows 10 calculator. The version of Delphi that I am using is 10.4.
Image of the program running (Example):
Here, it should be: 2.5 + 4 = 6.5 only and if the sum is of larger numbers, it gets more confusing.
I would also like you to explain to me why this happens in Delphi, because I have previously made this program in C# and the result is correct, without a lot of complications.
This is the source code:
program Project_Suma;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils, System.Math;
// Hacer un programa que lea dos números introducidos
// por el teclado y calcule e imprima la suma de los mismos.
begin
var
Num_1, Num_2: double;
Write('Introdusca un numero: ');
ReadLn(Num_1);
Write('Introdusca un numero: ');
ReadLn(Num_2);
WriteLn('Resultado: ', Num_1 + Num_2);
ReadLn;
end.
When dealing with floating point numbers, the standard output respects a scientific notation, what you should do in these cases is "format" the number, that is, represent the data in a more appropriate way to present it to the user, for example, by means of
Format()