Article View: comp.lang.c
Article #2071Re: variadic min and max, (any some and none, cat and more)
From: David Brown
Date: Tue, 01 Dec 2026 20:47
Date: Tue, 01 Dec 2026 20:47
55 lines
3243 bytes
3243 bytes
On 01/12/2026 20:29, bartc wrote:
> On 01/12/2026 18:22, Bonita Montero wrote:
>> Am 01.12.2026 um 18:48 schrieb bartc:
>>
>>> I had the option to use either ° or 'deg':
>>>
>>> 15 deg
>>
>> How about that ?
>>
>> #include <iostream>
>> #include <complex>
>> #include <cmath>
>>
>> using namespace std;
>>
>> struct degree {};
>>
>> complex<double> operator *( double angle, degree )
>> {
>> return complex<double>( sin( angle ), cos( angle ) );
>> }
>>
>> int main()
>> {
>> constexpr double Pi4 = 3.1415926535897932384626433832795 / 4.0;
>> complex<double> dPi4 = Pi4 * degree();
>> cout << abs( dPi4 ) << endl;
>> }
>>
>
> I don't what you're trying to do here or what the purpose of 'complex' is.
>
Bonita is representing a 2D position as a complex number - thus a
rotation about the origin by an angle x is the same as multiplying by
the complex number e ^ i.x, or cos(x) + i.sin(x). It's a common and
useful representation, but it does not fit with either the original 3D
vectors, or your "rotatematrix" function.
> Convert radians to degrees? Then this is an easier way to do it:
>
> #define todegrees 57.2968
>
> printf("%f\n", 3.14159 * todegrees); # display ~ 180
>
> But my example went the other way: converting numeric literals
> representing degrees, into radians. So it would be done like this:
>
> #define deg 0.01745329...
>
> printf("%f\n", 180 * deg); # display pi
>
>
Technical Details
Message-ID:
<11enbp2$24n1m$3@dont-email.me>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11bes8b$1gncr$1@dont-email.me> <11ek7b2$j8f6$1@raubtier-asyl.eternal-september.org> <11ekfu0$mq5n$4@dont-email.me> <11ekg71$n5p7$1@raubtier-asyl.eternal-september.org> <11ekgf8$mq5n$8@dont-email.me> <11ekjsp$pmch$2@raubtier-asyl.eternal-september.org> <11ekq4q$snda$1@dont-email.me> <11em45u$1fp0a$1@dont-email.me> <11emdhn$1ko8h$1@dont-email.me> <11emjh1$1ntap$1@dont-email.me> <11en1a0$1vqc1$1@dont-email.me> <11en399$20vkl$1@raubtier-asyl.eternal-september.org> <11en77a$2396m$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: David Brown <david.brown@hesbynett.no> Newsgroups: comp.lang.c Subject: Re: variadic min and max, (any some and none, cat and more) Date: Tue, 1 Dec 2026 21:47:30 +0100 Organization: A noiseless patient Spider Lines: 55 Message-ID: <11enbp2$24n1m$3@dont-email.me> References: <11bes8b$1gncr$1@dont-email.me> <11ek7b2$j8f6$1@raubtier-asyl.eternal-september.org> <11ekfu0$mq5n$4@dont-email.me> <11ekg71$n5p7$1@raubtier-asyl.eternal-september.org> <11ekgf8$mq5n$8@dont-email.me> <11ekjsp$pmch$2@raubtier-asyl.eternal-september.org> <11ekq4q$snda$1@dont-email.me> <11em45u$1fp0a$1@dont-email.me> <11emdhn$1ko8h$1@dont-email.me> <11emjh1$1ntap$1@dont-email.me> <11en1a0$1vqc1$1@dont-email.me> <11en399$20vkl$1@raubtier-asyl.eternal-september.org> <11en77a$2396m$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Tue, 01 Dec 2026 20:47:30 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2251830"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19wfvJijRVxl6UaoG5b7qcKb3cN6WxygwQ="; posting-host="c0f3271de497b8d6a8f25db294917010" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:NbBmKuis2W2gshktGJYETUTagYg= sha256:MlArvjDlLQK7pf70c5yPmVqGd+TGCaH61Hcad4oAiqo= sha1:Sf/I5OXV2esnsaCZn2t0LU4BKtU= sha256:aHVqtXkmt6pMWwubakTdcxvomayBkcXqO5NiC0WXPDU= Content-Language: en-GB In-Reply-To: <11en77a$2396m$1@dont-email.me>