fastinvsqrt:编程语言中的快速反平方根-源码

上传者: 42131618 | 上传时间: 2021-02-02 16:38:15 | 文件大小: 43KB | 文件类型: ZIP
编程语言中的快速反平方根 这是我用多种语言编写快速反平方根算法所面临的挑战的资源库。 用多种语言编写一种算法很有趣。 我用从未有过的语言写过一些代码。 我了解了语言之间的差异和相似之处,以及其他语言如何影响语言。 这个挑战只是我前进的道路。 现在,我想继续学习一些在挑战之前从未想到过的语言。 例如,我从未经历过Rust,OCaml和Erlang,但现在我认为我应该继续学习这些语言。 为什么选择此算法? 这是C语言的实现。 float fastInvSqrt ( float x) { int i = *( int *)&x; i = 0x5f3759df - (i >> 1 ); float y = *( float *)&i; return y * ( 1 . 5F - 0 . 5F * x * y * y); } 指针转换魔术是该算法的最重要部分。 我不解释为什么代码在这里起作用,请参考其他参考。 首先,选择算法不应太容易,也不应太困难。 如果问题很容易解决,我可以看一眼语言教程就能编写代码。 另一方面,如果太困难,我可以放弃挑战。 其次,在某些语言中

文件下载

资源详情

[{"title":"( 82 个子文件 43KB ) fastinvsqrt:编程语言中的快速反平方根-源码","children":[{"title":"fastinvsqrt-master","children":[{"title":".gitignore <span style='color:#111;'> 18B </span>","children":null,"spread":false},{"title":"Makefile <span style='color:#111;'> 290B </span>","children":null,"spread":false},{"title":"src","children":[{"title":"coffeescript","children":[{"title":"Makefile <span style='color:#111;'> 279B </span>","children":null,"spread":false},{"title":"fastinvsqrt.coffee <span style='color:#111;'> 498B </span>","children":null,"spread":false}],"spread":true},{"title":"kotlin","children":[{"title":"Makefile <span style='color:#111;'> 484B </span>","children":null,"spread":false},{"title":"fastinvsqrt.kt <span style='color:#111;'> 393B </span>","children":null,"spread":false}],"spread":true},{"title":"ocaml","children":[{"title":"Makefile <span style='color:#111;'> 274B </span>","children":null,"spread":false},{"title":"fastinvsqrt.ml <span style='color:#111;'> 444B </span>","children":null,"spread":false}],"spread":true},{"title":"smalltalk","children":[{"title":"Makefile <span style='color:#111;'> 292B </span>","children":null,"spread":false},{"title":"fastinvsqrt.st <span style='color:#111;'> 575B </span>","children":null,"spread":false}],"spread":true},{"title":"swift","children":[{"title":"Makefile <span style='color:#111;'> 415B </span>","children":null,"spread":false},{"title":"fastinvsqrt.swift <span style='color:#111;'> 311B </span>","children":null,"spread":false}],"spread":true},{"title":"nim","children":[{"title":"Makefile <span style='color:#111;'> 459B </span>","children":null,"spread":false},{"title":"fastinvsqrt.nim <span style='color:#111;'> 345B </span>","children":null,"spread":false}],"spread":true},{"title":"typescript","children":[{"title":"Makefile <span style='color:#111;'> 276B </span>","children":null,"spread":false},{"title":"fastinvsqrt.ts <span style='color:#111;'> 735B </span>","children":null,"spread":false}],"spread":true},{"title":"scheme","children":[{"title":"Makefile <span style='color:#111;'> 274B </span>","children":null,"spread":false},{"title":"fastinvsqrt.scm <span style='color:#111;'> 617B </span>","children":null,"spread":false}],"spread":true},{"title":"cpp","children":[{"title":"Makefile <span style='color:#111;'> 425B </span>","children":null,"spread":false},{"title":"fastinvsqrt.cpp <span style='color:#111;'> 413B </span>","children":null,"spread":false}],"spread":true},{"title":"erlang","children":[{"title":"Makefile <span style='color:#111;'> 500B </span>","children":null,"spread":false},{"title":"fastinvsqrt.erl <span style='color:#111;'> 585B </span>","children":null,"spread":false}],"spread":true},{"title":"fsharp","children":[{"title":"Makefile <span style='color:#111;'> 465B </span>","children":null,"spread":false},{"title":"FastInvSqrt.fs <span style='color:#111;'> 475B </span>","children":null,"spread":false}],"spread":false},{"title":"crystal","children":[{"title":"Makefile <span style='color:#111;'> 426B </span>","children":null,"spread":false},{"title":"fastinvsqrt.cr <span style='color:#111;'> 230B </span>","children":null,"spread":false}],"spread":false},{"title":"scala","children":[{"title":"FastInvSqrt.scala <span style='color:#111;'> 491B </span>","children":null,"spread":false},{"title":"Makefile <span style='color:#111;'> 484B </span>","children":null,"spread":false}],"spread":false},{"title":"elixir","children":[{"title":"Makefile <span style='color:#111;'> 485B </span>","children":null,"spread":false},{"title":"fastinvsqrt.exs <span style='color:#111;'> 540B </span>","children":null,"spread":false}],"spread":false},{"title":"javascript","children":[{"title":"Makefile <span style='color:#111;'> 273B </span>","children":null,"spread":false},{"title":"fastinvsqrt.js <span style='color:#111;'> 602B </span>","children":null,"spread":false}],"spread":false},{"title":"perl","children":[{"title":"Makefile <span style='color:#111;'> 273B </span>","children":null,"spread":false},{"title":"fastinvsqrt.pl <span style='color:#111;'> 265B </span>","children":null,"spread":false}],"spread":false},{"title":"objc","children":[{"title":"Makefile <span style='color:#111;'> 531B </span>","children":null,"spread":false},{"title":"fastinvsqrt.m <span style='color:#111;'> 429B </span>","children":null,"spread":false}],"spread":false},{"title":"c","children":[{"title":"Makefile <span style='color:#111;'> 412B </span>","children":null,"spread":false},{"title":"fastinvsqrt.c <span style='color:#111;'> 437B </span>","children":null,"spread":false}],"spread":false},{"title":"d","children":[{"title":"Makefile <span style='color:#111;'> 415B </span>","children":null,"spread":false},{"title":"fastinvsqrt.d <span style='color:#111;'> 409B </span>","children":null,"spread":false}],"spread":false},{"title":"java","children":[{"title":"Makefile <span style='color:#111;'> 474B </span>","children":null,"spread":false},{"title":"FastInvSqrt.java <span style='color:#111;'> 602B </span>","children":null,"spread":false}],"spread":false},{"title":"python","children":[{"title":"fastinvsqrt.py <span style='color:#111;'> 336B </span>","children":null,"spread":false},{"title":"Makefile <span style='color:#111;'> 275B </span>","children":null,"spread":false}],"spread":false},{"title":"rust","children":[{"title":"Makefile <span style='color:#111;'> 408B </span>","children":null,"spread":false},{"title":"fastinvsqrt.rs <span style='color:#111;'> 393B </span>","children":null,"spread":false}],"spread":false},{"title":"csharp","children":[{"title":"Makefile <span style='color:#111;'> 468B </span>","children":null,"spread":false},{"title":"FastInvSqrt.cs <span style='color:#111;'> 534B </span>","children":null,"spread":false}],"spread":false},{"title":"clojure","children":[{"title":"Makefile <span style='color:#111;'> 324B </span>","children":null,"spread":false},{"title":"fastinvsqrt.clj <span style='color:#111;'> 324B </span>","children":null,"spread":false}],"spread":false},{"title":"ruby","children":[{"title":"Makefile <span style='color:#111;'> 273B </span>","children":null,"spread":false},{"title":"fastinvsqrt.rb <span style='color:#111;'> 237B </span>","children":null,"spread":false}],"spread":false},{"title":"livescript","children":[{"title":"Makefile <span style='color:#111;'> 272B </span>","children":null,"spread":false},{"title":"fastinvsqrt.ls <span style='color:#111;'> 506B </span>","children":null,"spread":false}],"spread":false},{"title":"haskell","children":[{"title":"Makefile <span style='color:#111;'> 430B </span>","children":null,"spread":false},{"title":"fastinvsqrt.hs <span style='color:#111;'> 606B </span>","children":null,"spread":false}],"spread":false},{"title":"purescript","children":[{"title":"psc-package.json <span style='color:#111;'> 273B </span>","children":null,"spread":false},{"title":"package.json <span style='color:#111;'> 267B </span>","children":null,"spread":false},{"title":"Makefile <span style='color:#111;'> 603B </span>","children":null,"spread":false},{"title":"FastInvSqrt.purs <span style='color:#111;'> 1.11KB </span>","children":null,"spread":false}],"spread":false},{"title":"j","children":[{"title":"Makefile <span style='color:#111;'> 496B </span>","children":null,"spread":false},{"title":"fastinvsqrt.ijs <span style='color:#111;'> 201B </span>","children":null,"spread":false}],"spread":false},{"title":"go","children":[{"title":"Makefile <span style='color:#111;'> 411B </span>","children":null,"spread":false},{"title":"fastinvsqrt.go <span style='color:#111;'> 429B </span>","children":null,"spread":false}],"spread":false},{"title":"asm","children":[{"title":"Makefile <span style='color:#111;'> 417B </span>","children":null,"spread":false},{"title":"fastinvsqrt.s <span style='color:#111;'> 530B </span>","children":null,"spread":false}],"spread":false},{"title":"r","children":[{"title":"fastinvsqrt.r <span style='color:#111;'> 372B </span>","children":null,"spread":false},{"title":"Makefile <span style='color:#111;'> 275B </span>","children":null,"spread":false}],"spread":false},{"title":"visualbasic","children":[{"title":"Makefile <span style='color:#111;'> 461B </span>","children":null,"spread":false},{"title":"FastInvSqrt.vb <span style='color:#111;'> 683B </span>","children":null,"spread":false}],"spread":false},{"title":"php","children":[{"title":"Makefile <span style='color:#111;'> 273B </span>","children":null,"spread":false},{"title":"fastinvsqrt.php <span style='color:#111;'> 264B </span>","children":null,"spread":false}],"spread":false},{"title":"groovy","children":[{"title":"Makefile <span style='color:#111;'> 487B </span>","children":null,"spread":false},{"title":"FastInvSqrt.groovy <span style='color:#111;'> 335B </span>","children":null,"spread":false}],"spread":false}],"spread":false},{"title":".github","children":[{"title":"workflows","children":[{"title":"ci.yaml <span style='color:#111;'> 3.17KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"README.md <span style='color:#111;'> 8.04KB </span>","children":null,"spread":false},{"title":"script","children":[{"title":"install.sh <span style='color:#111;'> 247B </span>","children":null,"spread":false},{"title":"test.sh <span style='color:#111;'> 1.04KB </span>","children":null,"spread":false},{"title":"validate.c <span style='color:#111;'> 1.19KB </span>","children":null,"spread":false},{"title":"check_exec.sh <span style='color:#111;'> 100B </span>","children":null,"spread":false},{"title":"build.sh <span style='color:#111;'> 140B </span>","children":null,"spread":false},{"title":"clean.sh <span style='color:#111;'> 151B </span>","children":null,"spread":false}],"spread":true}],"spread":true}],"spread":true}]

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明