and it is easy enough to add other units, e.g.
real, parameter :: GRAD = PI / 200
Anybody remember those?
I see that the Fortran 2023 spec has added a bunch of parallel trig functions that work in degrees.
I find this sort of thing unnecessary. It seems conventional to add functions for converting between degrees and radians, but a simpler way is to simply define a conversion factor for each angle unit. One conversion factor is simpler than two functions for each angle unit.
% gfcx -o z a.f90 && ./z 0.500000000 0.500089288
One of these values is exact, and one of these raises FE_INEXACT.
On Sun, 20 Oct 2024 05:35:25 -0000 (UTC), Steven G. Kargl wrote:
% gfcx -o z a.f90 && ./z 0.500000000 0.500089288
One of these values is exact, and one of these raises FE_INEXACT.
Does it work for 29° and 31° as well? What’s so special about 30°?
On Tue, 22 Oct 2024 04:26:59 +0000, Lawrence D'Oliveiro wrote:
On Sun, 20 Oct 2024 05:35:25 -0000 (UTC), Steven G. Kargl wrote:
% gfcx -o z a.f90 && ./z 0.500000000 0.500089288
One of these values is exact, and one of these raises FE_INEXACT.
Does it work for 29° and 31° as well? What’s so special about 30°?
Really? This is high school trig.
For units of degree, mathematically sin(30) = 1/2, exactly!.
sin(30+n*360) = 1/2 is also exact.
On Tue, 22 Oct 2024 07:14:22 -0000 (UTC), Steven G. Kargl wrote:
On Tue, 22 Oct 2024 04:26:59 +0000, Lawrence D'Oliveiro wrote:
On Sun, 20 Oct 2024 05:35:25 -0000 (UTC), Steven G. Kargl wrote:
% gfcx -o z a.f90 && ./z 0.500000000 0.500089288
One of these values is exact, and one of these raises FE_INEXACT.
Does it work for 29° and 31° as well? What’s so special about 30°?
Really? This is high school trig.
For units of degree, mathematically sin(30) = 1/2, exactly!.
sin(30+n*360) = 1/2 is also exact.
What’s so special about 30°? Does that extend to 29° and 31° as well?
Did you take a high school trigonometry class?
On Sun, 20 Oct 2024 05:35:25 -0000 (UTC), Steven G. Kargl wrote:
% gfcx -o z a.f90 && ./z 0.500000000 0.500089288Does it work for 29° and 31° as well? What’s so special about 30°?
One of these values is exact, and one of these raises FE_INEXACT.
On Tue, 22 Oct 2024 22:32:34 -0000 (UTC), Steven G. Kargl wrote:
Did you take a high school trigonometry class?
Pro tip: answering a question with a question can be seen as an attempt
to deflect from the issue.
On 10/21/2024 10:26 PM, Lawrence D'Oliveiro wrote:
On Sun, 20 Oct 2024 05:35:25 -0000 (UTC), Steven G. Kargl wrote:
% gfcx -o z a.f90 && ./z 0.500000000 0.500089288
One of these values is exact, and one of these raises FE_INEXACT.
Does it work for 29° and 31° as well? What’s so special about 30°?
https://en.wikipedia.org/wiki/Niven%27s_theorem
On Tue, 22 Oct 2024 18:14:14 -0600, Louis Krupp wrote:
On 10/21/2024 10:26 PM, Lawrence D'Oliveiro wrote:
On Sun, 20 Oct 2024 05:35:25 -0000 (UTC), Steven G. Kargl wrote:
% gfcx -o z a.f90 && ./z 0.500000000 0.500089288
One of these values is exact, and one of these raises FE_INEXACT.
Does it work for 29° and 31° as well? What’s so special about 30°?
https://en.wikipedia.org/wiki/Niven%27s_theorem
So a whole set of extra functions, just to get a nice result for one
value?
Did you take a high school trigonometry class?
On Wed, 23 Oct 2024 04:06:26 -0000 (UTC), David Jones wrote:
Did you take a high school trigonometry class?
You seem obsessed with that.
Lawrence D'Oliveiro wrote:
On Wed, 23 Oct 2024 04:06:26 -0000 (UTC), David Jones wrote:
Did you take a high school trigonometry class?
You seem obsessed with that.
On Tue, 22 Oct 2024 18:14:14 -0600, Louis Krupp wrote:
On 10/21/2024 10:26 PM, Lawrence D'Oliveiro wrote:So a whole set of extra functions, just to get a nice result for one
On Sun, 20 Oct 2024 05:35:25 -0000 (UTC), Steven G. Kargl wrote:https://en.wikipedia.org/wiki/Niven%27s_theorem
% gfcx -o z a.f90 && ./z 0.500000000 0.500089288Does it work for 29° and 31° as well? What’s so special about 30°?
One of these values is exact, and one of these raises FE_INEXACT.
value?
On Wed, 23 Oct 2024 07:59:24 +0200, R Daneel Olivaw wrote:
Lawrence D'Oliveiro wrote:
On Wed, 23 Oct 2024 04:06:26 -0000 (UTC), David Jones wrote:
Did you take a high school trigonometry class?
You seem obsessed with that.
So your favourite functions return an exact result for sin 30°. Do they return an exact result for cos 30° as well?
On Wed, 23 Oct 2024 06:25:02 +0000, Lawrence D'Oliveiro wrote:
On Wed, 23 Oct 2024 07:59:24 +0200, R Daneel Olivaw wrote:
Lawrence D'Oliveiro wrote:
On Wed, 23 Oct 2024 04:06:26 -0000 (UTC), David Jones wrote:
Did you take a high school trigonometry class?
You seem obsessed with that.
So your favourite functions return an exact result for sin 30. Do they
return an exact result for cos 30 as well?
Nope. For REAL x, COSD(x) returns an exact result for all N >= 0
that satisfies 60+N*360 < 2**23.
Steven G. Kargl <sgk@removetroutmask.apl.washington.edu> wrote:
On Wed, 23 Oct 2024 06:25:02 +0000, Lawrence D'Oliveiro wrote:Could you give an example of where sind and cosd might be of use in a
On Wed, 23 Oct 2024 07:59:24 +0200, R Daneel Olivaw wrote:Nope. For REAL x, COSD(x) returns an exact result for all N >= 0 that
Lawrence D'Oliveiro wrote:
On Wed, 23 Oct 2024 04:06:26 -0000 (UTC), David Jones wrote:
Did you take a high school trigonometry class?
You seem obsessed with that.
So your favourite functions return an exact result for sin 30°. Do
they return an exact result for cos 30° as well?
satisfies 60+N*360 < 2**23.
piece of numerical software?
Steven G. Kargl <sgk@removetroutmask.apl.washington.edu> wrote:===
On Wed, 23 Oct 2024 06:25:02 +0000, Lawrence D'Oliveiro wrote:Could you give an example of where sind and cosd might be of use in a
On Wed, 23 Oct 2024 07:59:24 +0200, R Daneel Olivaw wrote:Nope. For REAL x, COSD(x) returns an exact result for all N >= 0
Lawrence D'Oliveiro wrote:So your favourite functions return an exact result for sin 30°. Do they >>> return an exact result for cos 30° as well?
On Wed, 23 Oct 2024 04:06:26 -0000 (UTC), David Jones wrote:
Did you take a high school trigonometry class?You seem obsessed with that.
that satisfies 60+N*360 < 2**23.
piece of numerical software?
Seriously, though, if you're interfacing with people, degrees are easier
and more familiar than radians.
Could you give an example of where sind and cosd might be of use in a
piece of numerical software?
On Wed, 23 Oct 2024 16:38:41 -0600, Louis Krupp wrote:
Seriously, though, if you're interfacing with people, degrees are easierBut trig calculations are easier in radians. And it is easy to convert
and more familiar than radians.
back and forth, as I explained in the posting that started this thread.
On Wed, 23 Oct 2024 16:38:41 -0600, Louis Krupp wrote:
Seriously, though, if you're interfacing with people, degrees are easier
and more familiar than radians.
But trig calculations are easier in radians. And it is easy to convert
back and forth, as I explained in the posting that started this thread.
Are trig calculations really easier in radians?
One of these values is wrong.
You seem to be missing that argument reduction for sind(x)
is much easier than argument reduction for sin(x).
On Thu, 24 Oct 2024 02:17:15 -0000 (UTC), Steven G. Kargl wrote:
One of these values is wrong.
Only if you assume the input numbers were somehow “exact” or “perfect” to
begin with.
There’s an old principle in computing: “Garbage In, Garbage Out”.
You seem to be missing that argument reduction for sind(x)
is much easier than argument reduction for sin(x).
But that only worked for one angle, and for nothing else.
For sin(x), argument reduction will give sin(0) = 0, exactly. That's one angle.
For sind(x), argument reduction will give sind(x) = 0, exactly,
for countable many angles.
On Thu, 24 Oct 2024 05:06:37 -0000 (UTC), Steven G. Kargl wrote:
For sin(x), argument reduction will give sin(0) = 0, exactly. That's one
angle.
More generally, it gives sin(x) ≃ x, for uncountably many angles.
For sind(x), argument reduction will give sind(x) = 0, exactly,
for countable many angles.
But it never gives sind(x) anywhere close to x.
It is, however, for floatin point arithmetic, correct to less than or
equal to 0.5 ULP.
On Thu, 24 Oct 2024 05:06:37 -0000 (UTC), Steven G. Kargl wrote:Are you sure about that? Is sin(x) = x for any value of x besides 0?
For sin(x), argument reduction will give sin(0) = 0, exactly. That's oneMore generally, it gives sin(x) ≃ x, for uncountably many angles.
angle.
Are you sure? sind(x) = sin(A * x) where A is PI/180, and if x is zero,For sind(x), argument reduction will give sind(x) = 0, exactly,But it never gives sind(x) anywhere close to x.
for countable many angles.
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 991 |
Nodes: | 10 (0 / 10) |
Uptime: | 119:55:22 |
Calls: | 12,958 |
Files: | 186,574 |
Messages: | 3,265,641 |