Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #2852 > unrolled thread
| Started by | j.strecha@gmail.com |
|---|---|
| First post | 2015-04-01 03:43 -0700 |
| Last post | 2015-04-02 20:43 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.graphics.apps.gnuplot
Curiosity: Arithmetic operations and leading zeros j.strecha@gmail.com - 2015-04-01 03:43 -0700
Re: Curiosity: Arithmetic operations and leading zeros Richard Owlett <rowlett@cloud85.net> - 2015-04-01 06:25 -0500
Re: Curiosity: Arithmetic operations and leading zeros j.strecha@gmail.com - 2015-04-01 05:57 -0700
Re: Curiosity: Arithmetic operations and leading zeros Karl <mail.kfr@gmx.net> - 2015-04-02 20:43 +0200
| From | j.strecha@gmail.com |
|---|---|
| Date | 2015-04-01 03:43 -0700 |
| Subject | Curiosity: Arithmetic operations and leading zeros |
| Message-ID | <b286ed07-4f0a-4fd2-bf03-dd3176de25f0@googlegroups.com> |
Hi, I recently discovered something curious about arithmetic operations in gnuplot: > gnuplot> print 2*66 > 132 > gnuplot> print 2*066 > 108 (gnuplot 5.0 patchlevel rc2) Apparently the multiplication behaves differently when leading zeros are present. Is this a bug, or a feature? Regards, JS
[toc] | [next] | [standalone]
| From | Richard Owlett <rowlett@cloud85.net> |
|---|---|
| Date | 2015-04-01 06:25 -0500 |
| Message-ID | <D4WdnR9wePZdSIbInZ2dnUU7-UOdnZ2d@supernews.com> |
| In reply to | #2852 |
j.strecha@gmail.com wrote:
> Hi,
>
> I recently discovered something curious about arithmetic operations in gnuplot:
>
>> gnuplot> print 2*66
>> 132
>> gnuplot> print 2*066
>> 108
>
> (gnuplot 5.0 patchlevel rc2)
>
> Apparently the multiplication behaves differently when leading zeros are present. Is this a bug, or a feature?
>
> Regards,
> JS
>
How does gnuplot handle input of octal numbers? {I don't have
gnuplot on this machine to check.)
I notice that for your example that for example shown the answer
is correct for octal input and defaulting to decimal on output.
[toc] | [prev] | [next] | [standalone]
| From | j.strecha@gmail.com |
|---|---|
| Date | 2015-04-01 05:57 -0700 |
| Message-ID | <e57120ff-2945-464a-a489-7e2961603a94@googlegroups.com> |
| In reply to | #2853 |
Of course, you're right. I didn't check for octal numbers. However, this appears to be an undocumented feature.
[toc] | [prev] | [next] | [standalone]
| From | Karl <mail.kfr@gmx.net> |
|---|---|
| Date | 2015-04-02 20:43 +0200 |
| Message-ID | <mfk2k5$qni$1@news.rz.uni-karlsruhe.de> |
| In reply to | #2854 |
Am 01.04.2015 um 14:57 schrieb j.strecha@gmail.com: > Of course, you're right. I didn't check for octal numbers. However, this appears to be an undocumented feature. > You can also enter hex numbers by starting them with "0x", btw. I've submitted a patch to the docs on this. Karl
[toc] | [prev] | [standalone]
Back to top | Article view | comp.graphics.apps.gnuplot
csiph-web