Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15581 > unrolled thread

bug in arithmetic expansion

Started byJoern Knoll <J.Knoll@gsi.de>
First post2019-11-09 11:52 +0100
Last post2019-11-09 11:52 +0100
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  bug in arithmetic expansion Joern Knoll <J.Knoll@gsi.de> - 2019-11-09 11:52 +0100

#15581 — bug in arithmetic expansion

FromJoern Knoll <J.Knoll@gsi.de>
Date2019-11-09 11:52 +0100
Subjectbug in arithmetic expansion
Message-ID<mailman.1100.1573308932.13325.bug-bash@gnu.org>
Hallo,

in playing around with digital keys (integers) which have a simple 
arithmetic check property, I encountered problemsusing bash's arithmetic 
expansion, when ever the used digital substrings have leading zeros. The 
problem shows up already for the simplest operations, namely converting 
a string argument to its numerical value, as shown below.

With thanks for your attention and best regards, Jörn Knoll

[tplx99]:/the/knoll > echo $((0123))
83
[tplx99]:/the/knoll > echo $((123))
123
[tplx99]:/the/knoll > echo $((01234))
668
[tplx99]:/the/knoll > echo $((1234))
1234


-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                          %
%     Jörn Knoll          phone: +49 6159 71 2753          %
%     GSI                 fax:   +49 6159 71 2990          %
%     Planckstr. 1        email:J.Knoll@gsi.de             %
%     D-64291 Darmstadthttps://theory.gsi.de             %
%                                                          %
%     GSI Student Programhttps://theory.gsi.de/stud-pro    %
%     Schnelle Ionen e.V.https://www.SchnelleIonen.de      %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web