Golang big.Float的精度问题

我遇到了一些有趣的Golang big.Float计算问题。</ p>

问题是</ p>

10001000100010001000100010001000100010001000100015.5533 / 1000000000000000000 </ p>

= 10001000100010001000100010001000.1000100010001000155533 </ p>

然而,big.Float给“10001000100010001000100010001000.10001000100010001555329999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997 “ </ p>

代码:</ p>

  var prec uint = 1024 // 512 
dec, := new(big.Float).SetPrec(prec).SetString(“ 1000000000000000000”)
f,
:= new(big.Float).SetPrec(prec).SetString(“ 100010001000100010001000100010001000100010001000100015.5533”)
q:= f .Quo(f,dec)

fmt.Printf(“ Percision:%d
”,prec)
fmt.Pri ntf(“商:%s
”,q.Text('f',-1))
</ code> </ pre>

结果:</ p>

 精度:1024 
商数:10001000100010001000100010001000.1000100010001000155532999999999999999999999999999999999999999999999999999999999 > </ p>

 精度:512 
商数:10001000100010001000100010001000.1000100010001000155533
</ code> </ pre>

任何人都知道我的问题是什么 代码或如何配置big.Float以获得预期的结果?</ p>

感谢所有人!</ p>
</ div>

展开原文

原文

I've met some interesting problem of Golang big.Float calculation.

The Problem is

10001000100010001000100010001000100010001000100015.5533 / 1000000000000000000

= 10001000100010001000100010001000.1000100010001000155533

However, big.Float gave "10001000100010001000100010001000.10001000100010001555329999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997"

The code:

var prec uint = 1024 // 512
dec, _ := new(big.Float).SetPrec(prec).SetString("1000000000000000000")
f, _ := new(big.Float).SetPrec(prec).SetString("10001000100010001000100010001000100010001000100015.5533")
q := f.Quo(f, dec)

fmt.Printf("Percision: %d
", prec)
fmt.Printf("Quotient: %s
", q.Text('f', -1))

Result:

Percision: 1024
Quotient: 10001000100010001000100010001000.10001000100010001555329999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997

And the more confusing part is, if I set prec = 512, a smaller precision, it produced correct result instead.

Percision: 512
Quotient: 10001000100010001000100010001000.1000100010001000155533

Doses any one know what's wrong of my code or how to configure big.Float to get expected result?

Thanks to all!

1个回答

From go doc math/big.Float:

A nonzero finite Float represents a multi-precision floating point number

sign × mantissa × 2**exponent

with 0.5 <= mantissa < 1.0, and MinExp <= exponent <= MaxExp.

And SetPrec sets the bitwidth of the mantissa not some decimal precision.

Like with float64s not every decimal number can be represented exact in a big.Float and your code shows this. The fact that you see what you expect to see with prec=512 is due to different rounding and printing.

Rule of thumb: big.Floats behave like "normal" floats with all their shortcomings (here not every decimal fraction can be represented) but may show less rounding errors.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
golang将big.Float转换为big.Int

<div class="post-text" itemprop="text"> <p>convert big.Float to big.Int, i write code below, but it overflow with uint64, so what's the correct way to cenvert big.Float to big.Int.</p> <pre><code>package main import "fmt" import "math/big" func FloatToBigInt(val float64) *big.Int { bigval := new(big.Float) bigval.SetFloat64(val) coin := new(big.Float) coin.SetInt(big.NewInt(1000000000000000000)) bigval.Mul(bigval, coin) result := new(big.Int) f,_ := bigval.Uint64() result.SetUint64(f) return result } func main() { fmt.Println("vim-go") fmt.Println(FloatToBigInt(float64(10))) fmt.Println(FloatToBigInt(float64(20))) fmt.Println(FloatToBigInt(float64(30))) fmt.Println(FloatToBigInt(float64(40))) fmt.Println(FloatToBigInt(float64(50))) fmt.Println(FloatToBigInt(float64(100))) fmt.Println(FloatToBigInt(float64(1000))) fmt.Println(FloatToBigInt(float64(10000))) } </code></pre> </div>

将JSON解组为Golang类型Big.Float

<div class="post-text" itemprop="text"> <p>I have a json message that needs to be unmarshaled to a struct which has some <code>big.Float</code> fields from the <code>math</code> package. The json field is of type numeric. It gives me <code>err = json: cannot unmarshal string into Go value of type *big.Float</code>.</p> <p>I wonder why it complains "cannot unmarshal string" since my json field is numeric type. And what do I need to do to unmarshal the json filed to a <code>*big.Float</code> field.</p> <p>Example:</p> <pre><code>type Msg struct { Usage0 *big.Float Usage1 *big.Float Usage2 *big.Float } // jsonMsg = {'Usage0': 31241.4543, "Usage1": 54354325423.65, ...} err := json.Unmarshal(jsonMsg, &amp;msg) </code></pre> </div>

big.Float SetPrec怪异的行为

<div class="post-text" itemprop="text"> <p>After doing some calculations using big.Float in golang, I am setting the precision to 2.</p> <p>And even thou the number is just a simple 10, after setting the precision it is 8.</p> <pre><code>package main import ( "fmt" "math/big" ) func main() { cost := big.NewFloat(10) fmt.Println("COST NOW", cost) perKWh := big.NewFloat(0) cost.Add(cost, perKWh) fmt.Println("COST ", cost.String()) perMinute := big.NewFloat(0) cost.Add(cost, perMinute) fmt.Println("COST ", cost.String()) discountAmount := big.NewFloat(0) cost.Sub(cost, discountAmount) floatCos, _ := cost.Float64() fmt.Println(fmt.Sprintf("COST FLOAT %v", floatCos)) cost.SetPrec(2) fmt.Println("COST ", cost.String()) } </code></pre> <p>Check playground example here: <a href="https://play.golang.org/p/JmCRXkD5u49" rel="nofollow noreferrer">https://play.golang.org/p/JmCRXkD5u49</a></p> <p>Would like to understand why</p> </div>

Golang数学/大元帅失去精度

<div class="post-text" itemprop="text"> <p>I have a struct like:</p> <pre><code>type Msg struct { F1 *big.Float `json:"F1,string"` } </code></pre> <p>Then I got a message in <code>json</code> from a message queue and then I want to unmarshal that json message into my <code>Msg</code> struct:</p> <pre><code>// jsonMsg = {"F1": "1000314.451234"} var msg Msg json.Unmarshal(jsonMsg, &amp;msg) </code></pre> <p>But I got:</p> <pre><code>fmt.Println("go object:",msg.F1.String()) // 1000314.45, precision lost </code></pre> <p>So the precision is lost when my string <code>"1000314.451234"</code> is unmarshaled to a <code>Msg</code> object in golang. I wonder if this is bug? How can I get the full precision? Thanks.</p> </div>

我如何将* big.Int转换为golang中的字节数组

<div class="post-text" itemprop="text"> <p>Im trying to do calculations on a big int number and then convert the result to a byte array, but I cannot figure out how to do so this is where Im at so far. anyone got any ideas</p> <pre><code>sum := big.NewInt(0) for _, num := range balances { sum = sum.Add(sum, num) } fmt.Println("total: ", sum) phrase := []byte(sum) phraseLen := len(phrase) padNumber := 65 - phraseLen </code></pre> </div>

如何将golang math / big int转换为float?

<div class="post-text" itemprop="text"> <p>I'm using the golang's bigint as counters for a long run service where the statistics counters might overflow a regular uint64 over long run; but occasionally I need to calculate something like what's the average rate since program beginning? need a division like <code>float(bigint) / time.Since(beginning).Seconds()</code>; the precision losing of conversion is acceptable in the rate calculation</p> <p><a href="https://golang.org/pkg/math/big/#Int.Uint64" rel="nofollow noreferrer">https://golang.org/pkg/math/big/#Int.Uint64</a></p> <p>but this kind of <code>float64(bigint)</code> doesn't work actually, I see the library has 'bigint.Uint64()' conversion but it's undefined if overflowed a regular uint64; I wonder why the standard library doesn't provide a to <code>.Float64()</code> method? and is there any workaround how to get a float</p> </div>

Golang net.Conn并行写入

<div class="post-text" itemprop="text"> <p>I have multiple Goroutines sharing a net.Conn object. Can they issue a Write calls simultaneously?</p> <p>My main concern is that of Write calls which are partially done. Say I intend to wrote 100 bytes, but only 30 were sent, so I need to send 70 more. For this I will typically write a loop:</p> <pre><code>count := 0 for count &lt; len(buf) { byteSent, err := conn.Write(buf[count:]) //check error count += byteSent } </code></pre> <p>But I see that Go implements this loop in <a href="https://golang.org/src/net/fd_unix.go" rel="nofollow">net.Conn.Write</a> line number 318 and it does so by taking a lock. </p> <p>However, on <a href="https://golang.org/src/net/fd_windows.go" rel="nofollow">Windows</a> implementation there is no such loop except that there is a call to WSASend. I do not know how WSASend behaves and could not get much from the MSDN docs</p> <p>Hence the questions are:</p> <p>[edit] Added 4th question</p> <ol> <li>Do I need to acquire a lock everytime I write to socket?</li> <li>If yes, then the purpose of acquiring the lock in Write implementation is defeated.</li> <li>In unix implementation, does it mean that I cannot get byteSent &lt; len(buf) unless err != nil? (I mean am I reading the code correct?)</li> <li>Does the WSASend on Windows implements the equivalent loop in Unix implementation </li> </ol> </div>

Golang:将字节数组转换为big.Int

<div class="post-text" itemprop="text"> <p>I'm trying to create an RSA Public Key from a Modulus and Exponent stored in a byte array. After some experimentation I've got the following:</p> <pre><code>func bytes_to_int(b []byte) (acc uint64) { length := len(b) if length % 4 != 0 { extra := (4 - length % 4) b = append([]byte(strings.Repeat("\000", extra)), b...) length += extra } var block uint32 for i := 0; i &lt; length; i += 4 { block = binary.BigEndian.Uint32(b[i:i+4]) acc = (acc &lt;&lt; 32) + uint64(block) } return } func main() { fmt.Println(bytes_to_int(data[:128])) fmt.Println(bytes_to_int(data[128:])) } </code></pre> <p>This appears to work (although I'm not convinced there isn't a better way). My next step was to convert it to use math/big in order to handle larger numbers. I can see an Lsh function to do the &lt;&lt; but can't figure out how to recursively add the Uint32(block) to the big.Int.</p> <p>For reference, the Public Key I'm attempting to import is a Mixmaster Key stored in a keyring (pubring.mix): <a href="http://www.mixmin.net/draft-sassaman-mixmaster-XX.html#key-format" rel="noreferrer">http://www.mixmin.net/draft-sassaman-mixmaster-XX.html#key-format</a> <a href="http://pinger.mixmin.net/pubring.mix" rel="noreferrer">http://pinger.mixmin.net/pubring.mix</a></p> </div>

Golang exec.Command程序的奇怪行为

<div class="post-text" itemprop="text"> <p>I have such code:</p> <pre><code>func main() { s := "foobar" cmd := exec.Command("wc", "-l") stdin, err := cmd.StdinPipe() if err != nil { log.Panic(err) } stdout, err := cmd.StdoutPipe() if err != nil { log.Panic(err) } err = cmd.Start() if err != nil { log.Panic(err) } io.Copy(stdin, bytes.NewBufferString(s)) stdin.Close() io.Copy(os.Stdout, stdout) err = cmd.Wait() if err != nil { log.Panic(err) } } </code></pre> <p>and its output is:</p> <p><code>0</code></p> <p>But when I will do simple modification:</p> <pre><code>func main() { runWcFromStdinWorks("aaa ") runWcFromStdinWorks("bbb ") } func runWcFromStdinWorks(s string) { cmd := exec.Command("wc", "-l") stdin, err := cmd.StdinPipe() if err != nil { log.Panic(err) } stdout, err := cmd.StdoutPipe() if err != nil { log.Panic(err) } err = cmd.Start() if err != nil { log.Panic(err) } io.Copy(stdin, bytes.NewBufferString(s)) stdin.Close() io.Copy(os.Stdout, stdout) err = cmd.Wait() if err != nil { log.Panic(err) } } </code></pre> <p>It works, but why? Its just calling method why first version is not working?</p> </div>

Golang Json.Marshal错误

<div class="post-text" itemprop="text"> <p>I have been trying to encode a map into JSON but I have been unsuccessful so far. Json.Marshal is not encoding value, its just encoding the key.</p> <p><a href="https://gist.github.com/rahulpache/9174490" rel="nofollow">https://gist.github.com/rahulpache/9174490</a></p> <pre><code>package main import ( "encoding/json" "fmt" ) type node struct { value string expiry float64 settime float64 } func main() { var x = make(map[string]node) x["hello"] = node{value: "world", expiry: 1, settime: 2} x["foo"] = node{value: "bar", expiry: 1, settime: 2} a, err := json.Marshal(x) fmt.Println(string(a)) } </code></pre> <p>Output:</p> <pre><code>{"foo":{},"hello":{}} </code></pre> </div>

golang exec.Command导致很多失效的进程

<div class="post-text" itemprop="text"> <p>I'm using golang to call pppd and then kill it after a while. However I got a lot of defunct proccesses in this way.</p> <p>This is how I run pppd</p> <pre><code>exec.Command("sh", "-c", "pppd call vpn").CombinedOutput() </code></pre> <p>This is how I kill it.</p> <pre><code>exec.Command("sh", "-c", "pkill pppd").CombinedOutput() </code></pre> <p>Then I got a lot of this</p> <pre><code>root 31541 23536 0 10:54 ? 00:00:00 [pppd] &lt;defunct&gt; root 31929 23356 0 10:55 ? 00:00:00 [pptpgw] &lt;defunct&gt; root 31933 23356 0 10:55 ? 00:00:00 [pptpcm] &lt;defunct&gt; root 31940 23356 0 10:55 ? 00:00:00 [pppd] &lt;defunct&gt; root 31993 23536 0 10:55 ? 00:00:00 [pptpgw] &lt;defunct&gt; root 31997 23536 0 10:55 ? 00:00:00 [pptpcm] &lt;defunct&gt; root 31998 23536 0 10:55 ? 00:00:00 [pppd] &lt;defunct&gt; root 32012 23356 0 10:55 ? 00:00:00 [pptpgw] &lt;defunct&gt; root 32016 23356 0 10:55 ? 00:00:00 [pptpcm] &lt;defunct&gt; root 32017 23356 0 10:56 ? 00:00:00 [pppd] &lt;defunct&gt; root 32070 23536 0 10:56 ? 00:00:00 [pptpgw] &lt;defunct&gt; root 32074 23536 0 10:56 ? 00:00:00 [pptpcm] &lt;defunct&gt; root 32075 23536 0 10:56 ? 00:00:00 [pppd] &lt;defunct&gt; root 32083 23356 0 10:56 ? 00:00:00 [pptpgw] &lt;defunct&gt; root 32087 23356 0 10:56 ? 00:00:00 [pptpcm] &lt;defunct&gt; root 32089 23356 0 10:56 ? 00:00:00 [pppd] &lt;defunct&gt; root 32131 23536 0 10:57 ? 00:00:00 [pptpgw] &lt;defunct&gt; root 32135 23536 0 10:57 ? 00:00:00 [pptpcm] &lt;defunct&gt; root 32148 23536 0 10:57 ? 00:00:00 [pppd] &lt;defunct&gt; root 32160 23356 0 10:57 ? 00:00:00 [pptpgw] &lt;defunct&gt; root 32164 23356 0 10:57 ? 00:00:00 [pptpcm] &lt;defunct&gt; root 32165 23356 0 10:57 ? 00:00:00 [pppd] &lt;defunct&gt; root 32177 23536 0 10:57 ? 00:00:00 [pptpgw] &lt;defunct&gt; root 32181 23536 0 10:57 ? 00:00:00 [pptpcm] &lt;defunct&gt; </code></pre> <p>How can I avoid defunct processes.</p> </div>

Golang io.Reader问题与jpeg.Decode返回EOF

<div class="post-text" itemprop="text"> <p>I am trying to take a multipart.File that is an io.Reader and decode it as a jpeg to covert into a Thumbnail using github.com/disintegration/imaging's library. I know in advance the data is going to be a jpeg. When I send the multipart.File to a ConvertImageToThumbnail function and it returns Unexpected EOF every time. What am I doing wrong?</p> <pre><code>package images import ( "github.com/disintegration/imaging" "image" "image/jpeg" "mime/multipart" ) func ConvertImageToThumbnail(pic multipart.File) (image.Image, error) { pic.Seek(0,0) // The solution was to seek back to the beginning of the file img,err := jpeg.Decode(pic) if err != nil { return nil, err } thumb := imaging.Thumbnail(img, 100, 100, imaging.CatmullRom) return thumb, nil } pic, header, err := r.FormFile("avatar") // check error defer pic.Close() </code></pre> </div>

golang os.Create导致“没有这样的文件或目录”错误

<div class="post-text" itemprop="text"> <p>Must be something simple, but I cannot seem to figure out. I keep getting "no such file or directory" error. Thought the Create function is to create a new file? package main</p> <pre><code>import ( "log" "os" ) func main() { f, err := os.Create("~/golang-server.log") defer f.Close() if err != nil { panic(err.Error()) } log.SetOutput(f) } </code></pre> </div>

golang regexp.matchString有什么问题?

<div class="post-text" itemprop="text"> <p>can any one explain why does this match <a href="https://play.golang.org/p/NJXD-nKnu7" rel="nofollow">play</a>? </p> <p>Source:</p> <pre><code>package main import "fmt" import "regexp" func main() { match, _ := regexp.MatchString("[a-z]+", "test?") fmt.Printf("the result of match: %v", match) } </code></pre> <p>isn't the golang's <code>regexp.MatchString</code> is fully match? I can't understand and I am a newbie for golang</p> </div>

Golang os.Open没有这样的文件或目录错误

<div class="post-text" itemprop="text"> <p>I am struggling to figure out an issue with os.Open. I keep getting a 'no such file or directory' error when using os.Open on a folder named templates. So I have my folder MVCApp with bin pkg src and templates in it. Then I have main in the src folder. So I have this code:</p> <pre><code>basePath := "templates" templateFolder, err := os.Open(basePath) if err != nil { log.Fatal(err) } defer templateFolder.Close() </code></pre> <p>I think it has something to do with the basePath that I am using with the open, but I cannot figure out how I need to preface "templates" in order for it to find this directory. I am sure this is an easy fix, but it has me perplexed. Any help would be greatly appreciated.</p> </div>

如何在Golang中将uint64转换为big.Int?

<div class="post-text" itemprop="text"> <p>I was wondering how can I convert a <code>uint64</code> to <code>big.Int</code> in golang? the shortest way. </p> <p>I have tried <code>new(big.Int).SetInt64(int64(a uint64 number))</code>. </p> <p>I don't like it cause it's long, too much nested conversions and I'd rather use a built-in function if it exists.</p> </div>

Golang,数学/大:* big.Int的最大值是多少

<div class="post-text" itemprop="text"> <p>What is the max value of <strong>*big.Int</strong> and max precision of <strong>*big.Rat</strong>?</p> </div>

golang exec.Command读取标准输入

<div class="post-text" itemprop="text"> <p>I have a go program that should invoke a ruby script.</p> <p>I have a <code>runCommand</code> function:</p> <pre><code>func runCommand(cmdName string, arg ...string) { cmd := exec.Command(cmdName, arg...) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr cmd.Stdin = os.Stdin err = cmd.Run() if err != nil { fmt.Printf("Failed to start Ruby. %s ", err.Error()) os.Exit(1) } } </code></pre> <p>I invoke it like this:</p> <pre><code>runCommand("ruby", "-e", "require 'foo'") </code></pre> <p>It works for most cases, except if there is a <code>gets</code> or any similar operation in the child process that needs to pause for an input.</p> <p>I have tried setting <code>cmd.Stdin = os.Stdin</code>, but it does not wait for input.</p> <p>What am I doing wrong? </p> </div>

golang sync.Map Range函数线程安全吗?

<div class="post-text" itemprop="text"> <p>From the <a href="https://golang.org/pkg/sync/#Map.Range" rel="nofollow noreferrer">doc</a></p> <pre><code>Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call. </code></pre> <p>Does this mean that no read lock is invoked during range call and user must implements his own mutex in order for <code>Range</code> call to be thread safe?</p> </div>

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

Vue + Spring Boot 项目实战(十九):Web 项目优化解决方案

快来一起探索如何打脸我们的破项目,兄弟姐妹们把害怕打在公屏上!

你连存活到JDK8中著名的Bug都不知道,我怎么敢给你加薪

CopyOnWriteArrayList.java和ArrayList.java,这2个类的构造函数,注释中有一句话 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 public ArrayList(Collection&lt;? ...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

CSDN:因博主近期注重写专栏文章(已超过150篇),订阅博主专栏人数在突增,近期很有可能提高专栏价格(已订阅的不受影响),提前声明,敬请理解!

CSDN:因博主近期注重写专栏文章(已超过150篇),订阅博主专栏人数在突增,近期很有可能提高专栏价格(已订阅的不受影响),提前声明,敬请理解! 目录 博客声明 大数据了解博主粉丝 博主的粉丝群体画像 粉丝群体性别比例、年龄分布 粉丝群体学历分布、职业分布、行业分布 国内、国外粉丝群体地域分布 博主的近期访问每日增量、粉丝每日增量 博客声明 因近期博主写专栏的文章越来越多,也越来越精细,逐步优化文章。因此,最近一段时间,订阅博主专栏的人数增长也非常快,并且专栏价

一个HashMap跟面试官扯了半个小时

一个HashMap能跟面试官扯上半个小时 关注 安琪拉的博客 1.回复面试领取面试资料 2.回复书籍领取技术电子书 3.回复交流领取技术电子书 前言 HashMap应该算是Java后端工程师面试的必问题,因为其中的知识点太多,很适合用来考察面试者的Java基础。 开场 面试官: 你先自我介绍一下吧! 安琪拉: 我是安琪拉,草丛三婊之一,最强中单(钟馗不服)!哦,不对,串场了,我是**,目...

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

记录下入职中软一个月(外包华为)

我在年前从上一家公司离职,没想到过年期间疫情爆发,我也被困在家里,在家呆着的日子让人很焦躁,于是我疯狂的投简历,看面试题,希望可以进大公司去看看。 我也有幸面试了我觉得还挺大的公司的(虽然不是bat之类的大厂,但是作为一名二本计算机专业刚毕业的大学生bat那些大厂我连投简历的勇气都没有),最后选择了中软,我知道这是一家外包公司,待遇各方面甚至不如我的上一家公司,但是对我而言这可是外包华为,能...

面试:第十六章:Java中级开发

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

培训班出来的人后来都怎么样了?(二)

接着上回说,培训班学习生涯结束了。后面每天就是无休止的背面试题,不是没有头脑的背,培训公司还是有方法的,现在回想当时背的面试题好像都用上了,也被问到了。回头找找面试题,当时都是打印下来天天看,天天背。 不理解呢也要背,面试造飞机,上班拧螺丝。班里的同学开始四处投简历面试了,很快就有面试成功的,刚开始一个,然后越来越多。不知道是什么原因,尝到胜利果实的童鞋,不满足于自己通过的公司,嫌薪水要少了,选择...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

工作八年,月薪60K,裸辞两个月,投简历投到怀疑人生!

近日,有网友在某职场社交平台吐槽,自己裸辞两个月了,但是找工作却让自己的心态都要崩溃了,全部无果,不是已查看无回音,就是已查看不符合。 “工作八年,两年一跳,裸辞两个月了,之前月薪60K,最近找工作找的心态崩了!所有招聘工具都用了,全部无果,不是已查看无回音,就是已查看不符合。进头条,滴滴之类的大厂很难吗???!!!投简历投的开始怀疑人生了!希望 可以收到大厂offer” 先来看看网...

大牛都会用的IDEA调试技巧!!!

导读 前天面试了一个985高校的实习生,问了他平时用什么开发工具,他想也没想的说IDEA,于是我抛砖引玉的问了一下IDEA的调试用过吧,你说说怎么设置断点...

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...

97年世界黑客编程大赛冠军作品(大小仅为16KB),惊艳世界的编程巨作

这是世界编程大赛第一名作品(97年Mekka ’97 4K Intro比赛)汇编语言所写。 整个文件只有4095个字节, 大小仅仅为16KB! 不仅实现了3D动画的效果!还有一段震撼人心的背景音乐!!! 内容无法以言语形容,实在太强大! 下面是代码,具体操作看最后! @echo off more +1 %~s0|debug e100 33 f6 bf 0 20 b5 10 f3 a5...

程序员是做全栈工程师好?还是专注一个领域好?

昨天,有位大一的同学私信我,说他要做全栈工程师。 我一听,这不害了孩子么,必须制止啊。 谁知,讲到最后,更确定了他做全栈程序员的梦想。 但凡做全栈工程师的,要么很惨,要么很牛! 但凡很牛的,绝不是一开始就是做全栈的! 全栈工程师听起来好听,但绝没有你想象的那么简单。 今天听我来给你唠,记得帮我点赞哦。 一、全栈工程师的职责 如果你学习编程的目的只是玩玩,那随意,想怎么学怎么学。...

不要再到处使用 === 了

我们知道现在的开发人员都使用 === 来代替 ==,为什么呢?我在网上看到的大多数教程都认为,要预测 JavaScript 强制转换是如何工作这太复杂了,因此建议总是使用===。这些都...

什么是a站、b站、c站、d站、e站、f站、g站、h站、i站、j站、k站、l站、m站、n站?00后的世界我不懂!

A站 AcFun弹幕视频网,简称“A站”,成立于2007年6月,取意于Anime Comic Fun,是中国大陆第一家弹幕视频网站。A站以视频为载体,逐步发展出基于原生内容二次创作的完整生态,拥有高质量互动弹幕,是中国弹幕文化的发源地;拥有大量超粘性的用户群体,产生输出了金坷垃、鬼畜全明星、我的滑板鞋、小苹果等大量网络流行文化,也是中国二次元文化的发源地。 B站 全称“哔哩哔哩(bilibili...

十个摸鱼,哦,不对,是炫酷(可以玩一整天)的网站!!!

文章目录前言正文**1、Kaspersky Cyberthreat real-time map****2、Finding Home****3、Silk – Interactive Generative Art****4、Liquid Particles 3D****5、WINDOWS93****6、Staggering Beauty****7、Ostagram图片生成器网址****8、全历史网址*...

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

用了这个 IDE 插件,5分钟解决前后端联调!

点击上方蓝色“程序猿DD”,选择“设为星标”回复“资源”获取独家整理的学习资料!作者 |李海庆我是一个 Web 开发前端工程师,受到疫情影响,今天是我在家办公的第78天。开发了两周,...

大厂的 404 页面都长啥样?最后一个笑了...

每天浏览各大网站,难免会碰到404页面啊。你注意过404页面么?猿妹搜罗来了下面这些知名网站的404页面,以供大家欣赏,看看哪个网站更有创意: 正在上传…重新上传取消 腾讯 正在上传…重新上传取消 网易 淘宝 百度 新浪微博 正在上传…重新上传取消 新浪 京东 优酷 腾讯视频 搜...

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

代码注释如此沙雕,会玩还是你们程序员!

某站后端代码被“开源”,同时刷遍全网的,还有代码里的那些神注释。 我们这才知道,原来程序员个个都是段子手;这么多年来,我们也走过了他们的无数套路… 首先,产品经理,是永远永远吐槽不完的!网友的评论也非常扎心,说看这些代码就像在阅读程序员的日记,每一页都写满了对产品经理的恨。 然后,也要发出直击灵魂的质问:你是尊贵的付费大会员吗? 这不禁让人想起之前某音乐app的穷逼Vip,果然,穷逼在哪里都是...

Java14 新特性解读

Java14 已于 2020 年 3 月 17 号发布,官方特性解读在这里:https://openjdk.java.net/projects/jdk/14/以下是个人对于特性的中文式...

前端还能这么玩?(女朋友生日,用前端写了一个好玩的送给了她,高兴坏了)

前端还能这么玩?(女朋友生日,用前端写了一个好玩的送给了她,高兴坏了)

爬虫(101)爬点重口味的

小弟最近在学校无聊的很哪,浏览网页突然看到一张图片,都快流鼻血。。。然后小弟冥思苦想,得干一点有趣的事情python 爬虫库安装https://s.taobao.com/api?_ks...

工作两年简历写成这样,谁要你呀!

作者:小傅哥 博客:https://bugstack.cn 沉淀、分享、成长,让自己和他人都能有所收获! 一、前言 最近有伙伴问小傅哥,我的简历怎么投递了都没有反应,心里慌的很呀。 工作两年了目前的公司没有什么大项目,整天的维护别人的代码,有坑也不让重构,都烦死了。荒废我一身技能无处施展,投递的简历也没人看。我是不动物园里的猩猩,狒狒了! 我要加班,我要996,我要疯狂编码,求给我个机会… ...

相关热词 c# 按行txt c#怎么扫条形码 c#打包html c# 实现刷新数据 c# 两个自定义控件重叠 c#浮点类型计算 c#.net 中文乱码 c# 时间排序 c# 必备书籍 c#异步网络通信
立即提问