本月博客排行
-
第1名
龙儿筝 -
第2名
johnsmith9th -
第3名
wy_19921005 - zysnba
- sgqt
- lemonhandsome
年度博客排行
-
第1名
宏天软件 -
第2名
青否云后端云 -
第3名
龙儿筝 - gashero
- wallimn
- vipbooks
- benladeng5225
- wy_19921005
- fantaxy025025
- e_e
- zysnba
- ssydxa219
- sam123456gz
- javashop
- arpenker
- tanling8334
- kaizi1992
- xpenxpen
- wiseboyloves
- xiangjie88
- ranbuijj
- ganxueyun
- sichunli_030
- xyuma
- wangchen.ily
- jh108020
- lemonhandsome
- zxq_2017
- jbosscn
- Xeden
- luxurioust
- lzyfn123
- zhanjia
- johnsmith9th
- forestqqqq
- ajinn
- nychen2000
- wjianwei666
- hanbaohong
- daizj
- 喧嚣求静
- silverend
- mwhgJava
- kingwell.leng
- lchb139128
- lich0079
- kristy_yy
- jveqi
- java-007
- sunj
最新文章列表
java.math.Math类常用的常量和方法
Math.PI 记录的圆周率
Math.E记录e的常量
Math.abs 求绝对值
Math.sin 正弦函数 Math.asin 反正弦函数
Math.cos 余弦函数 Math.acos 反余弦函数
Math.tan 正切函数 Math.atan 反正切函数 Math.atan2 商的反正切函数
Math.toDegrees 弧度转化为角度 Math.toRadians 角度转化为弧度
Math ...
python中的开放运算
要点:
将整数用浮点数表示:由于Python的整数除法,为了让诸如1/3的算式能得到正确的结果,需要将它表示为1.0/3.0。
幂为分数,底数为负数:当幂运算符的底数为负数、幂为分数时,Python会抛出ValueError: negative number cannot be raised to a fractional power异常,这时需要采用复数进行运算。因此凡是遇到幂为分数的项,都将底 ...
计算工具类
import java.math.BigDecimal;
import java.text.DecimalFormat;
/**
* 计算工具类
*
*/
public class MathUtil {
public static final int DEFAULT_SCALE = 5;
public static final int DIV_SCALE ...
各个编程语言都无法表达出非2的幂的float型变量的问题
原文:http://stackoverflow.com/questions/588004/is-floating-point-math-broken
表现:
0.1+0.2==0.3->false
0.1+0.2->
如何计算出大于某个值的最小2的次幂
例如,求出大于或等于12、13、15等数值的最小2的次幂:16;同理,大于等于5、6、7的最小次幂为8。
//v必须是一个32位整数
int roundup_power_of_2(unsigned int v)
{
v--;
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
v |= v > ...
线性插值法(linear interpolation)
线性插值(维基百科)https://zh.wikipedia.org/zh/%E7%BA%BF%E6%80%A7%E6%8F%92%E5%80%BC
线性插值法(百度百科)
http://baike.baidu.com/view/4685624.htm
UE4的线性插值函数:FTransform::LerpTranslationScale3D
https://do ...
Super Ugly Number
Write a program to find the nth super ugly number.
Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes of size k. For example, [1, 2, 4, 7, 8, 13, 14, 16 ...
Bulb Switcher
There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it's off or turning off i ...
Power of Three
Given an integer, write a function to determine if it is a power of three.
Follow up:
Could you do it without using any loop / recursion?
判断一个整数是否为3的幂。如果一个整数是3的幂,那么就可以表示为
3 ^ x = n => log(3^x) = ...
Ugly Number II
Write a program to find the n-th ugly number.
Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first 10 ug ...
Ugly Number
Write a program to check whether a given number is an ugly number.
Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it ...
Rectangle Area
Find the total area covered by two rectilinear rectangles in a 2D plane.
Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.
Assume that the total area is ...
Factorial Trailing Zeroes
Given an integer n, return the number of trailing zeroes in n!.
Note: Your solution should be in logarithmic time complexity.
给定一个整数n,让我们判断n的阶乘中末尾有几个零。我们只需要知道n的阶乘中有几个2和5的组合就可以,每个5前面都会有一个尾数为2的值,对于本身尾数 ...