FAQ
Hi

I am trying to use Golang in a programming competition. I have been using
Go since pre 1.0 and very regularly for a long time now.

However, I have been annoyed by trying to use it in a programming
competition primarily due to the lack of functions in the standard library
for functions that work on ints (not float64s).

There are no Min, Max, Sqrt (not even Sqrt !?), isPrime (without creating
bigint) functions. The lack of these functions are somewhat okay in large
scale projects (as there will usually be a library written or imported) but
it is kind of killing in a competition where programming time is crucial.

I have a few questions.

1) Are there any popular pseudo-standard libraries that does the math
functions for ints too ? We can even get programming competition websites
to include these libraries (like how jquery is available for most
javascript related competitions)
2) Why is the Sqrt function (supposedly non-trivial) also not included in
the standard library ?
3) Why are there functions for float64 alone defined in the standard
library ? Is it because they are tough to get right by application
programmers ?
4) Has anyone else used Go in a programming competition and want to share
some experiences ?

Thanks

Sankar

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Ingo Oeser at Feb 28, 2015 at 7:30 pm
    Jan Mercl has a pretty complete library
    here: http://godoc.org/github.com/cznic/mathutil
    On Saturday, February 28, 2015 at 3:32:33 PM UTC+1, Sankar wrote:

    Hi

    I am trying to use Golang in a programming competition. I have been using
    Go since pre 1.0 and very regularly for a long time now.

    However, I have been annoyed by trying to use it in a programming
    competition primarily due to the lack of functions in the standard library
    for functions that work on ints (not float64s).

    There are no Min, Max, Sqrt (not even Sqrt !?), isPrime (without creating
    bigint) functions. The lack of these functions are somewhat okay in large
    scale projects (as there will usually be a library written or imported) but
    it is kind of killing in a competition where programming time is crucial.

    I have a few questions.

    1) Are there any popular pseudo-standard libraries that does the math
    functions for ints too ? We can even get programming competition websites
    to include these libraries (like how jquery is available for most
    javascript related competitions)
    2) Why is the Sqrt function (supposedly non-trivial) also not included in
    the standard library ?
    3) Why are there functions for float64 alone defined in the standard
    library ? Is it because they are tough to get right by application
    programmers ?
    4) Has anyone else used Go in a programming competition and want to share
    some experiences ?

    Thanks

    Sankar
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Lars Seipel at Mar 1, 2015 at 2:00 am

    On Sat, Feb 28, 2015 at 06:32:33AM -0800, Sankar wrote:
    3) Why are there functions for float64 alone defined in the standard
    library ? Is it because they are tough to get right by application
    programmers ?
    Yes, that's probably one of the reasons. There are lots of special cases
    to consider when writing utility math functions that deal with floats.
    So it makes sense to do them right once and make them available through
    the standard library. That's not the case for (most of) their integer
    equivalents.

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Kevin Malachowski at Mar 1, 2015 at 2:47 am
    If you're allowed to use open source libraries in the competition then you could write one ahead of time with common functions and just use it.

    Otherwise, you could bring this up with the competition organizers and ask for special permission to use a library like that to make up for functions found in other language's starndard libs. I dont think a Sqrt that takes an int would ever make it into the go stdlib. That's a weird thing to need. Does it round up or down? Or does it round to the closest?

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Sankar P at Mar 1, 2015 at 3:04 am

    2015-03-01 8:16 GMT+05:30 Kevin Malachowski <niftastical@gmail.com>:
    If you're allowed to use open source libraries in the competition then you could write one ahead of time with common functions and just use it.
    This was my first attempt in using golang in a competition. Also, my
    first competition as well. So I was caught off-guard :)

    Also, I am not impressed with the idea behind this whole programming
    competitions itself after my first attempt, but that is a different
    story :)
    Otherwise, you could bring this up with the competition organizers and ask for special permission to use a library like that to make up for functions found in other language's starndard libs.
    Yes, that is the plan for this mail :) The mathutil provided by Ingo
    seems like a good fit (like what JQuery is for JS).

    Sankar
    --
    You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/WfNz_ElGNk0/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.


    --
    Sankar P
    http://psankar.blogspot.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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Filip Zaludek at Mar 1, 2015 at 7:03 am
    Integer Sqrt is one line of code enclosed in loop..

    http://play.golang.org/p/Gicgp4Mmpw

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedFeb 28, '15 at 2:32p
activeMar 1, '15 at 7:03a
posts6
users5
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase