Re: [go-nuts] ParseInt confusion

2021-02-09 Thread jsievers
Jochen Voss  writes:

> Dear all,
>
> The command strconv.ParseInt("256", 8, 8) should not return an error,
> because octal 256 is decimal 174 which fits into 8 bits.  Right?

Not unless the int is unsigned.

>
> I'm asking, because actually running this command gives
> 'strconv.ParseInt: parsing "256": value out of range'!  https://
> play.golang.org/p/gNKN0kKLfDd
>
> What am I overlooking here?
>
> All the best,
> Jochen
>
> --
> You received this message because you are subscribed to the Google
> Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/golang-nuts/
> 73e9d2a5-d8fb-468d-aebe-95f171bbff1dn%40googlegroups.com.
>
>

-- 
Jerry Sievers
e: jerry.siev...@comcast.net
p: 312.241.7800

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/87h7mlcglv.fsf%40jsievers.enova.com.


Re: [go-nuts] ParseInt confusion

2021-02-09 Thread Jochen Voss
Oh, yes, thank you and sorry about the noise!

On Tuesday, 9 February 2021 at 17:02:41 UTC ja...@kastelo.net wrote:

> An int8 has a range of -128 to +127. You may be looking for 
> strconv.ParseUint if you want an 8 bit unsigned int? 
>
> //jb
>
> On 9 Feb 2021, at 17:51, Jochen Voss  wrote:
>
> Dear all, 
>
> The command strconv.ParseInt("256", 8, 8) should not return an error, 
> because octal 256 is decimal 174 which fits into 8 bits.  Right?
>
> I'm asking, because actually running this command gives 'strconv.ParseInt: 
> parsing "256": value out of range'!  https://play.golang.org/p/gNKN0kKLfDd
>
> What am I overlooking here?
>
> All the best,
> Jochen
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/73e9d2a5-d8fb-468d-aebe-95f171bbff1dn%40googlegroups.com
>  
> 
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/d1dcd8dd-a31f-48e8-993d-005f05e24d91n%40googlegroups.com.


Re: [go-nuts] ParseInt confusion

2021-02-09 Thread Jakob Borg
An int8 has a range of -128 to +127. You may be looking for strconv.ParseUint 
if you want an 8 bit unsigned int?

//jb

On 9 Feb 2021, at 17:51, Jochen Voss 
mailto:jochen.v...@gmail.com>> wrote:

Dear all,

The command strconv.ParseInt("256", 8, 8) should not return an error, because 
octal 256 is decimal 174 which fits into 8 bits.  Right?

I'm asking, because actually running this command gives 'strconv.ParseInt: 
parsing "256": value out of range'!  https://play.golang.org/p/gNKN0kKLfDd

What am I overlooking here?

All the best,
Jochen

--
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/73e9d2a5-d8fb-468d-aebe-95f171bbff1dn%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/09F81861-DD8D-4001-8D83-F250264753CC%40kastelo.net.