Radians is the standard in programming languages I think, but it would be convenient with a set of functions for either, or at least predefined conversion functions/(macros).
Degrees are mostly used in calculators and when I look virtual calculator software on the internet, it always has an option to switch between degrees and radian.
As we have discuted before, sin and cos are often used for a lot of calculations. Any slow down of these functions will have a big speed impact on our programs!
I prefer differents dedicated functions for this reason :
"Sin" and "cos" in radians
"Sinq" and "cosq" or anything else, like "sind" and "cosd" for degrees.
djes wrote:I prefer differents dedicated functions for this reason :
"Sin" and "cos" in radians
"Sinq" and "cosq" or anything else, like "sind" and "cosd" for degrees.
You misunderstand, my request was for an optional unit parameter to allow sin and cos to work with degrees. There is no need for seperate commands because when compiled the two different versions can be use behind the scenes. Just like the Plot(x, y) and plot(x, y, colour) commands where the first is not accelerated but the second is.
djes wrote:I prefer differents dedicated functions for this reason :
"Sin" and "cos" in radians
"Sinq" and "cosq" or anything else, like "sind" and "cosd" for degrees.
You misunderstand, my request was for an optional unit parameter to allow sin and cos to work with degrees. There is no need for seperate commands because when compiled the two different versions can be use behind the scenes. Just like the Plot(x, y) and plot(x, y, colour) commands where the first is not accelerated but the second is.
in gfa sinq and cosq were doing lookups in a table instead of a real calculation to speed things up, and intermediate positions were just interpolated, not using the fpu
as degrees are mostly done in game purposes, this did make some sense
the question is just: would it make sense to do it this way on modern hardware, with modern fpu's ?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
blueznl wrote:in gfa sinq and cosq were doing lookups in a table instead of a real calculation to speed things up, and intermediate positions were just interpolated, not using the fpu?
Thats a good idea! As the only reason for asking this would be for games and the like, to quickly throw things around the screen.