Question about Round func. lazarus / 61-Beginners ---------------------------------------------------------------------- Ilya83 · 2024-12-30 21:42 FPC 3.2.2 I'm trying to draw Line with angle and I get weird values: Quotedx:= 200+round(cos(90)*200); dy:= 200-round(sin(90)*200); Gives: dx=110, dy=21 It should be: dx= 200, dy= 0 Am I wrong? ---------------------------------------------------------------------- speter · 2024-12-30 21:49 Sin and Cos use Radians not Degrees. cheers S. ---------------------------------------------------------------------- Ilya83 · 2024-12-30 22:32 QuoteShowMessage(FloatToStr(RadToDeg(cos(90))));  Gives: -25.67 ? ---------------------------------------------------------------------- jamie · 2024-12-30 22:34 no you must convert the value to COS and SIN COS(DegreeToRad(90)) etc ---------------------------------------------------------------------- Ilya83 · 2024-12-31 07:43 QuoteShowMessage(FloatToStr(cos(DegToRad(90))));  Gives: -2.71...E^-20 ---------------------------------------------------------------------- DragoRosso · 2024-12-31 08:14 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   ShowMessage(SimpleRoundTo(Cos(DegToRad(90)), -21).toString);  ShowMessage(SimpleRoundTo(Cos(DegToRad(90)), -8).toString); ---------------------------------------------------------------------- dseligo · 2024-12-31 11:31 Quote from: Ilya83 on December 31, 2024, 08:43:56 amQuoteShowMessage(FloatToStr(cos(DegToRad(90))));  Gives: -2.71...E^-20 And what does ShowMessage(FloatToStr(200 + cos(DegToRad(90)))); gives you? I mean that is what you want it, isn't it? ---------------------------------------------------------------------- Ilya83 · 2024-12-31 12:20 QuoteI mean that is what you want it, isn't it? It's perfect! Thanks everyone!