Liste des Groupes | Revenir à cl c |
mitchalsup@aol.com (MitchAlsup1) writes:
> ...Say you are a programmer and you receive a value like 2^53 from anI can't think of a scenario where that would be useful (other than just
Input read and you wan the most accurate possible SIN( of that ).
doing it for the sake of doing it).
If 2^53 represents a physical quantity, how likely is the actual value
to be known within ±π (+/i pi for those who prefer ASCII)?
If you can get better precision without too much extra cost, that's
great. I don't know enough to have an opinion about what the best
tradeoff is, but I presume it's going to be different depending on the
application.
Here's a C program that shows how precise sin(2^53) can be for types
float, double, and long double (I used gcc and glibc). The nextafter
functions are used to compute the nearest representable number. For
long double, the value of sin() changes by about 1 part in 1600, which
seems decent, but it's not nearly as precise as for values around 1.0.
For float and double, the imprecision of the argument is enough to make
the result practically meaningless.
Output:Is this output supposed to be different between gcc -O0 and gcc -O3?
float (32 bits, 24 mantissa bits)
9007199254740992.00000000 -0.84892595
9007200328482816.00000000 -0.34159181
double (64 bits, 53 mantissa bits)
9007199254740992.00000000 -0.84892596
9007199254740994.00000000 -0.12729655
long double (128 bits, 64 mantissa bits)
9007199254740992.00000000 -0.84892596
9007199254740992.00097656 -0.84944168
Date | Sujet | # | Auteur | |
14 Mar 24 | Re: Radians Or Degrees? | 55 | Michael S | |
14 Mar 24 | Re: Radians Or Degrees? | 9 | MitchAlsup1 | |
14 Mar 24 | Re: Radians Or Degrees? | 2 | MitchAlsup1 | |
15 Mar 24 | Re: Radians Or Degrees? | 1 | Terje Mathisen | |
14 Mar 24 | Re: Radians Or Degrees? | 5 | Lawrence D'Oliveiro | |
15 Mar 24 | Re: Radians Or Degrees? | 1 | Chris M. Thomasson | |
15 Mar 24 | Re: Radians Or Degrees? | 3 | MitchAlsup1 | |
15 Mar 24 | Re: Radians Or Degrees? | 2 | Chris M. Thomasson | |
15 Mar 24 | Re: Radians Or Degrees? | 1 | Chris M. Thomasson | |
15 Mar 24 | Re: Radians Or Degrees? | 1 | Michael S | |
15 Mar 24 | Re: Radians Or Degrees? | 28 | Terje Mathisen | |
15 Mar 24 | Re: Radians Or Degrees? | 3 | Michael S | |
16 Mar 24 | Re: Radians Or Degrees? | 2 | MitchAlsup1 | |
16 Mar 24 | Re: Radians Or Degrees? | 1 | Terje Mathisen | |
15 Mar 24 | Re: Radians Or Degrees? | 24 | Chris M. Thomasson | |
15 Mar 24 | Re: Radians Or Degrees? | 2 | Chris M. Thomasson | |
16 Mar 24 | Re: Radians Or Degrees? | 1 | Chris M. Thomasson | |
15 Mar 24 | Re: Radians Or Degrees? | 20 | Keith Thompson | |
15 Mar 24 | Re: Radians Or Degrees? | 5 | Chris M. Thomasson | |
15 Mar 24 | Re: Radians Or Degrees? | 4 | Chris M. Thomasson | |
16 Mar 24 | Re: Radians Or Degrees? | 3 | Keith Thompson | |
17 Mar 24 | Re: Radians Or Degrees? | 2 | Chris M. Thomasson | |
18 Mar 24 | Re: Radians Or Degrees? | 1 | Chris M. Thomasson | |
16 Mar 24 | Re: Radians Or Degrees? | 14 | MitchAlsup1 | |
16 Mar 24 | Re: Radians Or Degrees? | 13 | Michael S | |
16 Mar 24 | Re: Radians Or Degrees? | 12 | MitchAlsup1 | |
16 Mar 24 | Re: Radians Or Degrees? | 1 | Michael S | |
17 Mar 24 | Re: Radians Or Degrees? | 10 | Keith Thompson | |
17 Mar 24 | Re: Radians Or Degrees? | 5 | bart | |
17 Mar 24 | Re: Radians Or Degrees? | 4 | Keith Thompson | |
17 Mar 24 | Re: Radians Or Degrees? | 3 | bart | |
17 Mar 24 | Re: Radians Or Degrees? | 2 | Keith Thompson | |
17 Mar 24 | Re: Radians Or Degrees? | 1 | David Brown | |
17 Mar 24 | Re: Radians Or Degrees? | 4 | Michael S | |
17 Mar 24 | Re: Radians Or Degrees? | 1 | Michael S | |
17 Mar 24 | Re: Radians Or Degrees? | 2 | bart | |
17 Mar 24 | Re: Radians Or Degrees? | 1 | Michael S | |
16 Mar 24 | Re: Radians Or Degrees? | 1 | Chris M. Thomasson | |
18 Mar 24 | Re: Radians Or Degrees? | 17 | Stefan Monnier | |
19 Mar 24 | Re: Radians Or Degrees? | 16 | MitchAlsup1 | |
20 Mar 24 | Re: Radians Or Degrees? | 15 | Stefan Monnier | |
20 Mar 24 | Re: Radians Or Degrees? | 11 | Michael S | |
20 Mar 24 | Re: Radians Or Degrees? | 6 | Stefan Monnier | |
20 Mar 24 | Re: Radians Or Degrees? | 5 | MitchAlsup1 | |
21 Mar 24 | Re: Radians Or Degrees? | 4 | Terje Mathisen | |
21 Mar 24 | Re: Radians Or Degrees? | 3 | Michael S | |
21 Mar 24 | Re: Radians Or Degrees? | 1 | MitchAlsup1 | |
23 Mar 24 | Re: Radians Or Degrees? | 1 | Terje Mathisen | |
20 Mar 24 | Re: Radians Or Degrees? | 2 | Steven G. Kargl | |
20 Mar 24 | Re: Radians Or Degrees? | 1 | MitchAlsup1 | |
20 Mar 24 | Re: Radians Or Degrees? | 2 | MitchAlsup1 | |
21 Mar 24 | Re: Radians Or Degrees? | 1 | Michael S | |
20 Mar 24 | Re: Radians Or Degrees? | 2 | MitchAlsup1 | |
20 Mar 24 | Re: Radians Or Degrees? | 1 | Stefan Monnier | |
21 Mar 24 | Re: Radians Or Degrees? | 1 | Terje Mathisen |
Les messages affichés proviennent d'usenet.