matlab中直接用eps,默认是针对double双精度类型的.
在微软的msdn中是这么提的:
numeric_limits::epsilon
The function returns the difference between 1 and the smallest value greater than 1 that is representable for the data...
分类:
其他好文 时间:
2015-06-11 17:07:29
阅读次数:
232
Implement strStr()
题目:
mplement strStr().
Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
Update (2014-11-02):
The signature of...
分类:
其他好文 时间:
2015-06-11 14:41:57
阅读次数:
112
用Python写了一个postgresql函数,感觉很爽
CREATE LANGUAGE plpythonu;
postgresql函数
CREATE OR REPLACE FUNCTION myfun1(text)
RETURNS text AS
$BODY$
s = args[0]
h = 0;
n = len(s);
for i, c in enumerat...
分类:
数据库 时间:
2015-06-10 19:26:28
阅读次数:
164
具体代码如下:CREATE FUNCTION [dbo].[fn_NumberToChinese] (@number INT)RETURNS VARCHAR(20)AS BEGIN DECLARE @res VARCHAR(20); DECLARE @str VAR...
分类:
数据库 时间:
2015-06-09 23:18:44
阅读次数:
175
最近因为工作需要写了个登录校验函数,话不多说,贴代码,因为只是一个简单的介绍用法,所以核心判断我就全部去掉了。//最先要求是只返回一个用户id,于是简单的returns integer就可以完成。CREATE OR REPLACE FUNCTION validate_user()RETURNS in...
分类:
数据库 时间:
2015-06-09 19:16:49
阅读次数:
1088
/** * 根据json数据生成option树形控件 * 如果有children节点则自动生成树形数据 * @param {JSON} data * @param {int} n 节点深度 * @param {string} char 节点名称前缀 * @returns {string} * @si...
分类:
编程语言 时间:
2015-06-09 19:05:33
阅读次数:
124
摘要: 动画类API一、API 使用1. 1 d3.ease1.2 d3.timerStart a custom animation timer, invoking the specifiedfunctionrepeatedly until it returns true. There is no....
iter, dir_obj = lfs.dir (path)Lua iterator over the entries of a given directory. Each time the iterator is called withdir_objit returns a directory e...
分类:
其他好文 时间:
2015-06-08 23:01:51
阅读次数:
462
MDN :The Document.documentElement read-only property returns the Element that is the root element of the document (for example, the element for HTML ....
分类:
其他好文 时间:
2015-06-08 19:15:47
阅读次数:
127
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit i...
分类:
编程语言 时间:
2015-06-06 23:17:35
阅读次数:
152