可以转app的网站怎么做的天津市北辰区建设与管理局网站

news/2025/9/23 13:50:36/文章来源:
可以转app的网站怎么做的,天津市北辰区建设与管理局网站,百度普通收录,外贸定制网站小编典典碰巧的是不久前我写了一个BigFraction类#xff0c;用于解决Euler项目问题。它保留了BigInteger分子和分母#xff0c;因此它将永远不会溢出。但是#xff0c;对于许多你永远不会溢出的操作来说#xff0c;这会有点慢。无论如何#xff0c;请根据需要使用它。我一…小编典典碰巧的是不久前我写了一个BigFraction类用于解决Euler项目问题。它保留了BigInteger分子和分母因此它将永远不会溢出。但是对于许多你永远不会溢出的操作来说这会有点慢。无论如何请根据需要使用它。我一直很想以某种方式炫耀它。:)编辑该代码的最新最出色的版本包括单元测试现在托管在GitHub上也可以通过Maven Central获得。我将原始代码留在这里以便此答案不仅仅是一个链接…import java.math.*;/*** Arbitrary-precision fractions, utilizing BigIntegers for numerator and* denominator. Fraction is always kept in lowest terms. Fraction is* immutable, and guaranteed not to have a null numerator or denominator.* Denominator will always be positive (so sign is carried by numerator,* and a zero-denominator is impossible).*/public final class BigFraction extends Number implements Comparable{private static final long serialVersionUID 1L; //because Number is Serializableprivate final BigInteger numerator;private final BigInteger denominator;public final static BigFraction ZERO new BigFraction(BigInteger.ZERO, BigInteger.ONE, true);public final static BigFraction ONE new BigFraction(BigInteger.ONE, BigInteger.ONE, true);/*** Constructs a BigFraction with given numerator and denominator. Fraction* will be reduced to lowest terms. If fraction is negative, negative sign will* be carried on numerator, regardless of how the values were passed in.*/public BigFraction(BigInteger numerator, BigInteger denominator){if(numerator null)throw new IllegalArgumentException(Numerator is null);if(denominator null)throw new IllegalArgumentException(Denominator is null);if(denominator.equals(BigInteger.ZERO))throw new ArithmeticException(Divide by zero.);//only numerator should be negative.if(denominator.signum() 0){numerator numerator.negate();denominator denominator.negate();}//create a reduced fractionBigInteger gcd numerator.gcd(denominator);this.numerator numerator.divide(gcd);this.denominator denominator.divide(gcd);}/*** Constructs a BigFraction from a whole number.*/public BigFraction(BigInteger numerator){this(numerator, BigInteger.ONE, true);}public BigFraction(long numerator, long denominator){this(BigInteger.valueOf(numerator), BigInteger.valueOf(denominator));}public BigFraction(long numerator){this(BigInteger.valueOf(numerator), BigInteger.ONE, true);}/*** Constructs a BigFraction from a floating-point number.** Warning: round-off error in IEEE floating point numbers can result* in answers that are unexpected. For example,* System.out.println(new BigFraction(1.1))* will print:* 2476979795053773/2251799813685248** This is because 1.1 cannot be expressed exactly in binary form. The* given fraction is exactly equal to the internal representation of* the double-precision floating-point number. (Which, for 1.1, is:* (-1)^0 * 2^0 * (1 0x199999999999aL / 0x10000000000000L).)** NOTE: In many cases, BigFraction(Double.toString(d)) may give a result* closer to what the user expects.*/public BigFraction(double d){if(Double.isInfinite(d))throw new IllegalArgumentException(double val is infinite);if(Double.isNaN(d))throw new IllegalArgumentException(double val is NaN);//special case - math below wont work right for 0.0 or -0.0if(d 0){numerator BigInteger.ZERO;denominator BigInteger.ONE;return;}final long bits Double.doubleToLongBits(d);final int sign (int)(bits 63) 0x1;final int exponent ((int)(bits 52) 0x7ff) - 0x3ff;final long mantissa bits 0xfffffffffffffL;//number is (-1)^sign * 2^(exponent) * 1.mantissaBigInteger tmpNumerator BigInteger.valueOf(sign0 ? 1 : -1);BigInteger tmpDenominator BigInteger.ONE;//use shortcut: 2^x 1 x. if x is negative, shift the denominatorif(exponent 0)tmpNumerator tmpNumerator.multiply(BigInteger.ONE.shiftLeft(exponent));elsetmpDenominator tmpDenominator.multiply(BigInteger.ONE.shiftLeft(-exponent));//1.mantissa 1 mantissa/2^52 (2^52 mantissa)/2^52tmpDenominator tmpDenominator.multiply(BigInteger.valueOf(0x10000000000000L));tmpNumerator tmpNumerator.multiply(BigInteger.valueOf(0x10000000000000L mantissa));BigInteger gcd tmpNumerator.gcd(tmpDenominator);numerator tmpNumerator.divide(gcd);denominator tmpDenominator.divide(gcd);}/*** Constructs a BigFraction from two floating-point numbers.** Warning: round-off error in IEEE floating point numbers can result* in answers that are unexpected. See BigFraction(double) for more* information.** NOTE: In many cases, BigFraction(Double.toString(numerator) / Double.toString(denominator))* may give a result closer to what the user expects.*/public BigFraction(double numerator, double denominator){if(denominator 0)throw new ArithmeticException(Divide by zero.);BigFraction tmp new BigFraction(numerator).divide(new BigFraction(denominator));this.numerator tmp.numerator;this.denominator tmp.denominator;}/*** Constructs a new BigFraction from the given BigDecimal object.*/public BigFraction(BigDecimal d){this(d.scale() 0 ? d.unscaledValue().multiply(BigInteger.TEN.pow(-d.scale())) : d.unscaledValue(),d.scale() 0 ? BigInteger.ONE : BigInteger.TEN.pow(d.scale()));}public BigFraction(BigDecimal numerator, BigDecimal denominator){if(denominator.equals(BigDecimal.ZERO))throw new ArithmeticException(Divide by zero.);BigFraction tmp new BigFraction(numerator).divide(new BigFraction(denominator));this.numerator tmp.numerator;this.denominator tmp.denominator;}/*** Constructs a BigFraction from a String. Expected format is numerator/denominator,* but /denominator part is optional. Either numerator or denominator may be a floating-* point decimal number, which in the same format as a parameter to the* BigDecimal(String) constructor.** throws NumberFormatException if the string cannot be properly parsed.*/public BigFraction(String s){int slashPos s.indexOf(/);if(slashPos 0){BigFraction res new BigFraction(new BigDecimal(s));this.numerator res.numerator;this.denominator res.denominator;}else{BigDecimal num new BigDecimal(s.substring(0, slashPos));BigDecimal den new BigDecimal(s.substring(slashPos1, s.length()));BigFraction res new BigFraction(num, den);this.numerator res.numerator;this.denominator res.denominator;}}/*** Returns this f.*/public BigFraction add(BigFraction f){if(f null)throw new IllegalArgumentException(Null argument);//n1/d1 n2/d2 (n1*d2 d1*n2)/(d1*d2)return new BigFraction(numerator.multiply(f.denominator).add(denominator.multiply(f.numerator)),denominator.multiply(f.denominator));}/*** Returns this b.*/public BigFraction add(BigInteger b){if(b null)throw new IllegalArgumentException(Null argument);//n1/d1 n2 (n1 d1*n2)/d1return new BigFraction(numerator.add(denominator.multiply(b)),denominator, true);}/*** Returns this n.*/public BigFraction add(long n){return add(BigInteger.valueOf(n));}/*** Returns this - f.*/public BigFraction subtract(BigFraction f){if(f null)throw new IllegalArgumentException(Null argument);return new BigFraction(numerator.multiply(f.denominator).subtract(denominator.multiply(f.numerator)),denominator.multiply(f.denominator));}/*** Returns this - b.*/public BigFraction subtract(BigInteger b){if(b null)throw new IllegalArgumentException(Null argument);return new BigFraction(numerator.subtract(denominator.multiply(b)),denominator, true);}/*** Returns this - n.*/public BigFraction subtract(long n){return subtract(BigInteger.valueOf(n));}/*** Returns this * f.*/public BigFraction multiply(BigFraction f){if(f null)throw new IllegalArgumentException(Null argument);return new BigFraction(numerator.multiply(f.numerator), denominator.multiply(f.denominator));}/*** Returns this * b.*/public BigFraction multiply(BigInteger b){if(b null)throw new IllegalArgumentException(Null argument);return new BigFraction(numerator.multiply(b), denominator);}/*** Returns this * n.*/public BigFraction multiply(long n){return multiply(BigInteger.valueOf(n));}/*** Returns this / f.*/public BigFraction divide(BigFraction f){if(f null)throw new IllegalArgumentException(Null argument);if(f.numerator.equals(BigInteger.ZERO))throw new ArithmeticException(Divide by zero);return new BigFraction(numerator.multiply(f.denominator), denominator.multiply(f.numerator));}/*** Returns this / b.*/public BigFraction divide(BigInteger b){if(b null)throw new IllegalArgumentException(Null argument);if(b.equals(BigInteger.ZERO))throw new ArithmeticException(Divide by zero);return new BigFraction(numerator, denominator.multiply(b));}/*** Returns this / n.*/public BigFraction divide(long n){return divide(BigInteger.valueOf(n));}/*** Returns this^exponent.*/public BigFraction pow(int exponent){if(exponent 0)return BigFraction.ONE;else if (exponent 1)return this;else if (exponent 0)return new BigFraction(denominator.pow(-exponent), numerator.pow(-exponent), true);elsereturn new BigFraction(numerator.pow(exponent), denominator.pow(exponent), true);}/*** Returns 1/this.*/public BigFraction reciprocal(){if(this.numerator.equals(BigInteger.ZERO))throw new ArithmeticException(Divide by zero);return new BigFraction(denominator, numerator, true);}/*** Returns the complement of this fraction, which is equal to 1 - this.* Useful for probabilities/statistics.*/public BigFraction complement(){return new BigFraction(denominator.subtract(numerator), denominator, true);}/*** Returns -this.*/public BigFraction negate(){return new BigFraction(numerator.negate(), denominator, true);}/*** Returns -1, 0, or 1, representing the sign of this fraction.*/public int signum(){return numerator.signum();}/*** Returns the absolute value of this.*/public BigFraction abs(){return (signum() 0 ? negate() : this);}/*** Returns a string representation of this, in the form* numerator/denominator.*/public String toString(){return numerator.toString() / denominator.toString();}/*** Returns if this object is equal to another object.*/public boolean equals(Object o){if(!(o instanceof BigFraction))return false;BigFraction f (BigFraction)o;return numerator.equals(f.numerator) denominator.equals(f.denominator);}/*** Returns a hash code for this object.*/public int hashCode(){//using the method generated by Eclipse, but streamlined a bit..return (31 numerator.hashCode())*31 denominator.hashCode();}/*** Returns a negative, zero, or positive number, indicating if this object* is less than, equal to, or greater than f, respectively.*/public int compareTo(BigFraction f){if(f null)throw new IllegalArgumentException(Null argument);//easy case: this and f have different signsif(signum() ! f.signum())return signum() - f.signum();//next easy case: this and f have the same denominatorif(denominator.equals(f.denominator))return numerator.compareTo(f.numerator);//not an easy case, so first make the denominators equal then compare the numeratorsreturn numerator.multiply(f.denominator).compareTo(denominator.multiply(f.numerator));}/*** Returns the smaller of this and f.*/public BigFraction min(BigFraction f){if(f null)throw new IllegalArgumentException(Null argument);return (this.compareTo(f) 0 ? this : f);}/*** Returns the maximum of this and f.*/public BigFraction max(BigFraction f){if(f null)throw new IllegalArgumentException(Null argument);return (this.compareTo(f) 0 ? this : f);}/*** Returns a positive BigFraction, greater than or equal to zero, and less than one.*/public static BigFraction random(){return new BigFraction(Math.random());}public final BigInteger getNumerator() { return numerator; }public final BigInteger getDenominator() { return denominator; }//implementation of Number class. may cause overflow.public byte byteValue() { return (byte) Math.max(Byte.MIN_VALUE, Math.min(Byte.MAX_VALUE, longValue())); }public short shortValue() { return (short)Math.max(Short.MIN_VALUE, Math.min(Short.MAX_VALUE, longValue())); }public int intValue() { return (int) Math.max(Integer.MIN_VALUE, Math.min(Integer.MAX_VALUE, longValue())); }public long longValue() { return Math.round(doubleValue()); }public float floatValue() { return (float)doubleValue(); }public double doubleValue() { return toBigDecimal(18).doubleValue(); }/*** Returns a BigDecimal representation of this fraction. If possible, the* returned value will be exactly equal to the fraction. If not, the BigDecimal* will have a scale large enough to hold the same number of significant figures* as both numerator and denominator, or the equivalent of a double-precision* number, whichever is more.*/public BigDecimal toBigDecimal(){//Implementation note: A fraction can be represented exactly in base-10 iff its//denominator is of the form 2^a * 5^b, where a and b are nonnegative integers.//(In other words, if there are no prime factors of the denominator except for//2 and 5, or if the denominator is 1). So to determine if this denominator is//of this form, continually divide by 2 to get the number of 2s, and then//continually divide by 5 to get the number of 5s. Afterward, if the denominator//is 1 then there are no other prime factors.//Note: number of 2s is given by the number of trailing 0 bits in the numberint twos denominator.getLowestSetBit();BigInteger tmpDen denominator.shiftRight(twos); // x / 2^n x nfinal BigInteger FIVE BigInteger.valueOf(5);int fives 0;BigInteger[] divMod null;//while(tmpDen % 5 0) { fives; tmpDen / 5; }while(BigInteger.ZERO.equals((divMod tmpDen.divideAndRemainder(FIVE))[1])){fives;tmpDen divMod[0];}if(BigInteger.ONE.equals(tmpDen)){//This fraction will terminate in base 10, so it can be represented exactly as//a BigDecimal. We would now like to make the fraction of the form//unscaled / 10^scale. We know that 2^x * 5^x 10^x, and our denominator is//in the form 2^twos * 5^fives. So use max(twos, fives) as the scale, and//multiply the numerator and deminator by the appropriate number of 2s or 5s//such that the denominator is of the form 2^scale * 5^scale. (Of course, we//only have to actually multiply the numerator, since all we need for the//BigDecimal constructor is the scale.BigInteger unscaled numerator;int scale Math.max(twos, fives);if(twos fives)unscaled unscaled.shiftLeft(fives - twos); //x * 2^n x nelse if (fives twos)unscaled unscaled.multiply(FIVE.pow(twos - fives));return new BigDecimal(unscaled, scale);}//else: this number will repeat infinitely in base-10. So try to figure out//a good number of significant digits. Start with the number of digits required//to represent the numerator and denominator in base-10, which is given by//bitLength / log[2](10). (bitLenth is the number of digits in base-2).final double LG10 3.321928094887362; //Precomputed ln(10)/ln(2), a.k.a. log[2](10)int precision Math.max(numerator.bitLength(), denominator.bitLength());precision (int)Math.ceil(precision / LG10);//If the precision is less than 18 digits, use 18 digits so that the number//will be at least as accurate as a cast to a double. For example, with//the fraction 1/3, precision will be 1, giving a result of 0.3. This is//quite a bit different from what a user would expect.if(precision 18)precision 18;return toBigDecimal(precision);}/*** Returns a BigDecimal representation of this fraction, with a given precision.* param precision the number of significant figures to be used in the result.*/public BigDecimal toBigDecimal(int precision){return new BigDecimal(numerator).divide(new BigDecimal(denominator), new MathContext(precision, RoundingMode.HALF_EVEN));}//--------------------------------------------------------------------------// PRIVATE FUNCTIONS//--------------------------------------------------------------------------/*** Private constructor, used when you can be certain that the fraction is already in* lowest terms. No check is done to reduce numerator/denominator. A check is still* done to maintain a positive denominator.** param throwaway unused variable, only here to signal to the compiler that this* constructor should be used.*/private BigFraction(BigInteger numerator, BigInteger denominator, boolean throwaway){if(denominator.signum() 0){this.numerator numerator.negate();this.denominator denominator.negate();}else{this.numerator numerator;this.denominator denominator;}}}2020-03-19

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/912741.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

衡水冀县做网站wordpress微信快捷支付

人到中年有点甜获取Redis1、通过官网http://redis.io/获取稳定版源码包下载地址;2、通过wget http://download.redis.io/releases/redis-3.0.2.tar.gz下载 源码包;2编译安装Redis1、解压源码安装包,通过tar -xvf redis-3.0.2.tar.gz解压源码&…

杭州网络科技网站建设工程法律网站

在C语言中&#xff0c;你可以使用标准库中的文件操作函数来读取INI文件&#xff0c;然后解析其中的内容以找到对应的键和值。以下是一个简单的示例代码&#xff0c;演示如何实现这一过程&#xff1a; #include <stdio.h> #include <string.h>#define MAX_LINE_LEN…

ssh如何打开可视化界面

ssh如何打开可视化界面在远程 Ubuntu 系统上安装 X11sudo apt update sudo apt install xauth xorg openbox在本机通过 SSH 启用 X11 转发: 在连接时加上 -X 或 -Y 参数:ssh -Y username@remote_ip-X 会启用基本的 X…

淘宝上做网站的信得过吗东莞网站建设方案外包

移除视频声音是将视频指定的声音移除&#xff0c;可以选择移除人物声音还是视频的背景音乐&#xff0c;方便实现二次创作。 小编给大家推荐一些方法帮助大家更轻松地移除视频中的背景音乐或人物声音&#xff0c;有兴趣的朋友请自行百度查找&#xff0c;或小程序查找 1、方法&a…

html做旅游网站国外字体设计网站

mne-python脑电图和肌电图是一个开源软件分析、处理和显示。遵循bsd许可协议,由哈佛大学和共同开发的社区。主要功能包括:预处理和脑电图\/梅格信号的去噪,源估计、时频分析、统计测试,功能连接,机器学习,可视化的传感器、来源等外资支持最常见的原始数据格式。默认的(和附带的…

抚州市城乡建设局网站网站网页基本情况 网页栏目设置

一、源码特点 springboot 出租车管理系统是一套完善的完整信息系统&#xff0c;结合springboot框架和bootstrap完成本系统&#xff0c;对理解JSP java编程开发语言有帮助系统采用springboot框架&#xff08;MVC模式开发&#xff09;&#xff0c; 系统具有完整的源代码和数据…

卡密网站怎么做的苏州网站建设套餐

1、什么是硬间隔和软间隔&#xff1f; 当训练数据线性可分时&#xff0c;通过硬间隔最大化&#xff0c;学习一个线性分类器&#xff0c;即线性可分支持向量机。 当训练数据近似线性可分时&#xff0c;引入松弛变量&#xff0c;通过软间隔最大化&#xff0c;学习一个线性分类器…

怎么弄免费的空间做网站做网页和做网站的区别

[css] 如何解决css加载字体跨域的问题&#xff1f; 刚才碰到一个css加载字体跨域问题&#xff0c;记录一下。 站点的动态请求与静态文件请求是不同的域名的。站点的域名为 www.domain.com&#xff0c;而静态文件的域名为 st.domain.com。 问题&#xff1a; 页面中加载css文件&…

网站建设柚子网络科技在哪里希望小学学校网站建设方案

刚毕业的大学生&#xff0c;都怀揣着雄心壮志&#xff0c;出人头地 工作一两年后&#xff0c;技术提升的飞快&#xff0c;不断学习和使用新技术 工作三四年后&#xff0c;每个月的工资也以肉眼可见的速度提升着&#xff0c;工资开始以万为单位计算 工作五六年后&#xff0c;…

NanoCAD 24.0安装包下载地址与安装教程

NanoCAD 24.0 是一款功能全面且专业的国产CAD软件,支持64位操作系统,兼容Windows 11、Windows 10、Windows 8及Windows 7系统。该软件提供全功能DWG CAD平台,集成参数化3D实体建模工具,采用Autodesk Inventor风格界…

专业网站优化方案网站项目如何做需求分析报告

/*这是一个调用fork函数创建一个子进程&#xff0c;然后分别打印输出子进程和父进程中的变量的实例*/#include #include #include #include int glob 6; //外部变量int main(void){int var; //内部变量pid_t pid; //文件标识符var 88;//内部变量printf("…

深入解析:MES系统在不同制造行业中的应用差异与共性

深入解析:MES系统在不同制造行业中的应用差异与共性2025-09-23 13:41 tlnshuju 阅读(0) 评论(0) 收藏 举报pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; dis…

改 187 个接口参数:Postman 卡壳时,Apipost 凭什么 5 分钟搞定?

当你第一次通过目录参数为 10 个接口批量添加模块参数,并自动继承全局配置时,会明白:好的工具,真的能让工作效率发生质变。作为一名有 8 年 API 测试的工程师,我曾无数次在 Postman 里重复着机械操作:凌晨 2 点紧…

使用AWS Amplify、Lambda、API Gateway和DynamoDB部署静态Web应用

本教程详细介绍了如何利用AWS无服务器服务构建完整的Web应用。通过创建简单的求和计算器,您将学习如何配置DynamoDB数据库、编写Lambda函数、设置API Gateway接口,并使用Amplify部署前端页面。整个架构无需管理服务器…

有没有做培养基的网站服务公司理念

【说明】文章内容来自《机器学习——基于sklearn》&#xff0c;用于学习记录。若有争议联系删除。 1、评价指标 对于模型的评价往往会使用损失函数和评价指标&#xff0c;两者的本质是一致的。一般情况下&#xff0c;损失函数应用于训练过程&#xff0c;而评价指标应用于测试过…

上海制作网站公司哪家好推广广告

存储引擎 MySQL体系结构 连接层&#xff1a; 最上层是一些客户端和连接服务&#xff0c;主要完成一些类似于连接处理、授权认证、及相关的安全方案。服务器也会为安全接入的每个客户端验证它所具有的操作权限。服务层&#xff1a; 第二层架构主要完成大多数的核心服务功能&…

那个网站做国外售货用ps做网站尺寸

创作不易&#xff0c;请大家多鼓励支持。 在现实生活中&#xff0c;很多人的资料是不愿意公布在互联网上的&#xff0c;但是我们又要使用人工智能的能力帮我们处理文件、做决策、执行命令那怎么办呢&#xff1f;于是我们构建自己或公司的私人GPT变得非常重要。 先看效果 他的…

织梦采集侠官方网站济南 网站 建设

1.委托模式 委托模式&#xff1a;操作对象不会去处理某段逻辑&#xff0c;而是会把工作委托给另外一个辅助对象去处理。 例如我们要设计一个自定义类的来实现Set&#xff0c;可以将该实现委托给另一个对象&#xff1a; class MySet<T> (val helperSet: HashSet<T>…

上海网站开发怎么做苏州网页制作设计

一、简述传统的lru链表lru&#xff1a;least recently used相信大家对lru链表是不陌生的&#xff0c;它算是一种基础的数据结构吧&#xff0c;而且想必面试时也被问到过什么是lru链表&#xff0c;甚至是让你手写一个lru链表。想必你已经知道了mysql的buffer pool机制以及mysql组…

不用vip也能看的黄台的app中山seo技术

题目传送门&#xff1a;LOJ #3156。 题意简述&#xff1a; 有一张 \(n\) 个点 \(m\) 条边的有向图&#xff0c;边有两个权值 \(p_i\) 和 \(q_i\)&#xff08;\(p_i<q_i\)&#xff09;表示若 \(p_i\) 时刻在这条边的起点&#xff0c;则 \(q_i\) 时刻能到达这条边的终点。 你需…