Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | jacob navia <jacob@spamsink.net> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | And |
| Date | 2012-01-20 23:52 +0100 |
| Organization | lccwin |
| Message-ID | <jfcr7q$g40$1@speranza.aioe.org> (permalink) |
| References | (2 earlier) <rubrum-05D6FB.15510218012012@news.albasani.net> <jf7st7$i9u$1@dont-email.me> <rubrum-579D41.12414020012012@news.albasani.net> <jfcp91$n7r$1@dont-email.me> <jfcq1p$sjd$1@dont-email.me> |
Le 20/01/12 23:32, James Kuyper a écrit : > > Let me expand upon that comment. The key reason for your unmet > expectations in this case was the "usual arithmetic conversions" > (6.1.3.8). Those same conversions apply to many other arithmetic > operators: *, /, +, -,<,<=,>,>=, ==, !=, bitwise&, ^, bitwise |, > ?:. The corresponding compound assignment operators, and the ++ and -- > operators all have their behavior defined in terms of those operator, so > they perform the usual arithmetic conversions, too. Is the % operator > really the only one where the usual arithmetic conversions cause a > result that doesn't meet your expectations? That seems quite implausible > to me. Computer arithmetic has nothing to do with maths. For instance: A+B is different from A for all B different than zero. A+B is equal to A if A is a floating point number and B is smaller than the floating point epsilon for that type. Or A + B is different than B + A. And I could go on for a while. Mathematics is concerned about numbers as abstract entities that have abstract properties that can't be reproduced in a finite machine with a finite and time limited operator. Those are the basics. Now, some systems like Maple or Maxima approach MORE the maths we are used to, and should be used when you do maths. C is a computer language that doesn't shield you from the concrete machine you are using. It is the lowest "high level" language in existence, always just a bit above assembler. To expect to find here "sane" mathematical laws shows only a certain ignorance from Mr Press, specially if he uses unsigned numbers, and then he mixes them with negative values... Unsigned numbers correspond to the set 0-UINT_MAX, and can't be used with negative values. That should be obvious too but apparently Mr Press doesn't know that. If he is disappointed with C I would recommend him to use Maxima, a free mathematical system available for all, written in Lisp. jacob
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
C arithmetic question. Michael Press <rubrum@pacbell.net> - 2012-01-18 10:32 -0800
Re: C arithmetic question. James Kuyper <jameskuyper@verizon.net> - 2012-01-18 14:03 -0500
Re: C arithmetic question. TheGunslinger <mikiesrunsbaal.sec@sbcglobal.net> - 2012-01-18 19:30 -0800
Re: C arithmetic question. James Kuyper <jameskuyper@verizon.net> - 2012-01-19 08:10 -0500
Re: C arithmetic question. Markus Wichmann <nullplan@gmx.net> - 2012-01-18 21:14 +0100
Re: C arithmetic question. "BartC" <bc@freeuk.com> - 2012-01-19 10:44 +0000
Re: C arithmetic question. Seebs <usenet-nospam@seebs.net> - 2012-01-21 21:32 +0000
Re: C arithmetic question. Peter Nilsson <airia@acay.com.au> - 2012-01-18 13:51 -0800
Re: C arithmetic question. Michael Press <rubrum@pacbell.net> - 2012-01-18 15:51 -0800
Re: C arithmetic question. James Kuyper <jameskuyper@verizon.net> - 2012-01-18 20:50 -0500
Re: C arithmetic question. Michael Press <rubrum@pacbell.net> - 2012-01-20 12:41 -0800
Re: C arithmetic question. Keith Thompson <kst-u@mib.org> - 2012-01-20 14:11 -0800
Re: C arithmetic question. gazelle@shell.xmission.com (Kenny McCormack) - 2012-01-20 22:43 +0000
Re: C arithmetic question. James Kuyper <jameskuyper@verizon.net> - 2012-01-20 17:19 -0500
Re: C arithmetic question. James Kuyper <jameskuyper@verizon.net> - 2012-01-20 17:32 -0500
And jacob navia <jacob@spamsink.net> - 2012-01-20 23:52 +0100
Re: And Markus Wichmann <nullplan@gmx.net> - 2012-01-21 19:23 +0100
Re: And Keith Thompson <kst-u@mib.org> - 2012-01-21 13:20 -0800
Re: And jacob navia <jacob@spamsink.net> - 2012-01-21 23:02 +0100
Re: And Markus Wichmann <nullplan@gmx.net> - 2012-01-22 15:24 +0100
Re: And Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-01-22 15:40 +0000
Re: And blp@cs.stanford.edu (Ben Pfaff) - 2012-01-21 11:02 -0800
Re: C arithmetic question. Rui Maciel <rui.maciel@gmail.com> - 2012-01-24 18:53 +0000
Re: C arithmetic question. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-01-19 02:09 +0000
Re: C arithmetic question. Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-01-18 23:00 -0700
Re: C arithmetic question. Michael Press <rubrum@pacbell.net> - 2012-01-18 23:14 -0800
Re: C arithmetic question. Ike Naar <ike@sverige.freeshell.org> - 2012-01-19 08:41 +0000
Re: C arithmetic question. Michael Press <rubrum@pacbell.net> - 2012-01-20 12:43 -0800
Re: C arithmetic question. Kaz Kylheku <kaz@kylheku.com> - 2012-01-20 22:17 +0000
Re: C arithmetic question. Michael Press <rubrum@pacbell.net> - 2012-01-21 00:12 -0800
Re: C arithmetic question. Seebs <usenet-nospam@seebs.net> - 2012-01-21 21:32 +0000
Re: C arithmetic question. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-01-21 23:21 +0000
Re: C arithmetic question. Robert Wessel <robertwessel2@yahoo.com> - 2012-01-22 00:48 -0600
Re: C arithmetic question. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-01-22 11:45 +0000
Re: C arithmetic question. Robert Wessel <robertwessel2@yahoo.com> - 2012-01-22 21:46 -0600
Re: C arithmetic question. Kaz Kylheku <kaz@kylheku.com> - 2012-01-23 04:17 +0000
Re: C arithmetic question. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-01-23 11:19 +0000
Re: C arithmetic question. Tim Rentsch <txr@alumni.caltech.edu> - 2012-01-26 10:41 -0800
Re: C arithmetic question. Seebs <usenet-nospam@seebs.net> - 2012-01-23 07:58 +0000
Re: C arithmetic question. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-01-23 11:06 +0000
Re: C arithmetic question. James Kuyper <jameskuyper@verizon.net> - 2012-01-23 07:03 -0500
Re: C arithmetic question. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-01-23 17:27 +0000
Re: C arithmetic question. Keith Thompson <kst-u@mib.org> - 2012-01-19 02:38 -0800
Re: C arithmetic question. Dr Nick <3-nospam@temporary-address.org.uk> - 2012-01-20 07:30 +0000
Re: C arithmetic question. Nomen Nescio <nobody@dizum.com> - 2012-01-19 12:28 +0100
Re: C arithmetic question. Michael Press <rubrum@pacbell.net> - 2012-01-20 12:44 -0800
Re: C arithmetic question. 88888 Dihedral <dihedral88888@googlemail.com> - 2012-01-20 13:14 -0800
Re: C arithmetic question. James Kuyper <jameskuyper@verizon.net> - 2012-01-19 08:45 -0500
Re: C arithmetic question. Chad <cdalten@gmail.com> - 2012-01-24 08:14 -0800
Re: C arithmetic question. James Kuyper <jameskuyper@verizon.net> - 2012-01-24 12:15 -0500
Re: C arithmetic question. Chad <cdalten@gmail.com> - 2012-01-24 09:26 -0800
Re: C arithmetic question. James Kuyper <jameskuyper@verizon.net> - 2012-01-24 12:39 -0500
Re: C arithmetic question. Chad <cdalten@gmail.com> - 2012-01-24 10:03 -0800
Re: C arithmetic question. James Kuyper <jameskuyper@verizon.net> - 2012-01-24 13:23 -0500
Re: C arithmetic question. Chad <cdalten@gmail.com> - 2012-01-24 10:40 -0800
Re: C arithmetic question. James Kuyper <jameskuyper@verizon.net> - 2012-01-24 14:35 -0500
Re: C arithmetic question. Chad <cdalten@gmail.com> - 2012-01-24 12:04 -0800
Re: C arithmetic question. Chad <cdalten@gmail.com> - 2012-01-24 12:02 -0800
Re: C arithmetic question. Kleuske <kleuske@nowhere.net> - 2012-01-24 20:26 +0000
Re: C arithmetic question. Chad <cdalten@gmail.com> - 2012-01-24 13:45 -0800
Re: C arithmetic question. James Kuyper <jameskuyper@verizon.net> - 2012-01-24 15:40 -0500
Re: C arithmetic question. Chad <cdalten@gmail.com> - 2012-01-24 12:09 -0800
Re: C arithmetic question. Rui Maciel <rui.maciel@gmail.com> - 2012-01-24 18:48 +0000
Re: C arithmetic question. "osmium" <r124c4u102@comcast.net> - 2012-01-19 08:12 -0600
Re: C arithmetic question. Geoff <geoff@invalid.invalid> - 2012-01-20 15:33 -0800
Re: C arithmetic question. Kleuske <kleuske@nowhere.net> - 2012-01-27 08:17 +0000
Re: C arithmetic question. Geoff <geoff@invalid.invalid> - 2012-01-27 13:37 -0800
csiph-web