Program to calculate pi
#8
(03-06-2023, 06:18 PM)bplus Wrote: FYI QB64 has _Hypot(x, y) function!
https://qb64phoenix.com/qb64wiki/index.php/HYPOT

For 2 points (x1, y1) and (x2, y2)
dist = _Hypot(x1 - x2, y1, y2)

I didn't know that either. I imagine there are loads of utility functions added since the original BASIC that I should be using. In this instance it's surely quicker to stick with x.x + y.y and no square root or hypot function at all. Nice to see a less lazy version than my quick one though! I didn't realise this technique actually had a name!
Reply


Messages In This Thread
Program to calculate pi - by Kernelpanic - 02-26-2023, 10:18 PM
RE: Program to calculate pi - by david_uwi - 03-04-2023, 07:29 PM
RE: Program to calculate pi - by Kernelpanic - 03-04-2023, 10:51 PM
RE: Program to calculate pi - by bplus - 03-04-2023, 11:43 PM
RE: Program to calculate pi - by RokCoder - 03-06-2023, 12:04 PM
RE: Program to calculate pi - by BSpinoza - 03-06-2023, 05:05 PM
RE: Program to calculate pi - by bplus - 03-06-2023, 06:18 PM
RE: Program to calculate pi - by RokCoder - 03-06-2023, 07:29 PM
RE: Program to calculate pi - by JRace - 03-07-2023, 12:34 AM



Users browsing this thread: 4 Guest(s)