本文整理汇总了C++中copy_double函数的典型用法代码示例。如果您正苦于以下问题:C++ copy_double函数的具体用法?C++ copy_double怎么用?C++ copy_double使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了copy_double函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stat_aux
static value stat_aux(int use_64, struct stat *buf)
{
CAMLparam0();
CAMLlocal5(atime, mtime, ctime, offset, v);
atime = copy_double((double) buf->st_atime);
mtime = copy_double((double) buf->st_mtime);
ctime = copy_double((double) buf->st_ctime);
offset = use_64 ? Val_file_offset(buf->st_size) : Val_int (buf->st_size);
v = alloc_small(12, 0);
Field (v, 0) = Val_int (buf->st_dev);
Field (v, 1) = Val_int (buf->st_ino);
Field (v, 2) = cst_to_constr(buf->st_mode & S_IFMT, file_kind_table,
sizeof(file_kind_table) / sizeof(int), 0);
Field (v, 3) = Val_int (buf->st_mode & 07777);
Field (v, 4) = Val_int (buf->st_nlink);
Field (v, 5) = Val_int (buf->st_uid);
Field (v, 6) = Val_int (buf->st_gid);
Field (v, 7) = Val_int (buf->st_rdev);
Field (v, 8) = offset;
Field (v, 9) = atime;
Field (v, 10) = mtime;
Field (v, 11) = ctime;
CAMLreturn(v);
}
示例2: simulation_get_pose2d_stub
value simulation_get_pose2d_stub(value sim_val, value name_val)
{
CAMLparam2(sim_val, name_val);
CAMLlocal1(result);
playerc_simulation_t *sim = Simulation_val(sim_val);
char *name = String_val(name_val);
double x, y, a;
DPRINTF("getting sim %p pose2d: name - %s\n", sim, name);
if(playerc_simulation_get_pose2d(sim, name, &x, &y, &a))
exception_playerc_error();
DPRINTF("got sim %p pose2d: name - %s x = %f y = %f a = %f\n",
sim, name, x, y, a);
result = caml_alloc_tuple(3);
Store_field(result, 0, copy_double(x));
Store_field(result, 1, copy_double(y));
Store_field(result, 2, copy_double(a));
CAMLreturn(result);
}
示例3: ml_gsl_poly_solve_cubic
CAMLprim value ml_gsl_poly_solve_cubic(value a, value b, value c)
{
double x0, x1, x2;
int n ;
n = gsl_poly_solve_cubic(Double_val(a), Double_val(b),
Double_val(c), &x0, &x1, &x2);
{
CAMLparam0();
CAMLlocal1(r);
r = Val_int(0); /* to silence compiler warnings */
switch(n) {
case 0:
break;
case 1:
r = alloc(1, 0);
Store_field(r, 0, copy_double(x0));
break;
case 3:
r = alloc(3, 1);
Store_field(r, 0, copy_double(x0));
Store_field(r, 1, copy_double(x1));
Store_field(r, 2, copy_double(x2));
} ;
CAMLreturn(r);
};
}
示例4: ml_evas_object_size_hint_align_get
PREFIX value ml_evas_object_size_hint_align_get(value v_obj)
{
CAMLparam0();
CAMLlocal1(v);
double x, y;
evas_object_size_hint_align_get((Evas_Object*) v_obj, &x, &y);
v = caml_alloc(2, 0);
Store_field(v, 0, copy_double(x));
Store_field(v, 1, copy_double(y));
CAMLreturn(v);
}
示例5: ml_Elm_Gesture_Zoom_Info_of_ptr
PREFIX value ml_Elm_Gesture_Zoom_Info_of_ptr(value v_ptr)
{
CAMLparam1(v_ptr);
CAMLlocal1(v_info);
Elm_Gesture_Zoom_Info* info = voidp_val(v_ptr);
v_info = caml_alloc(4, 0);
Store_field(v_info, 0, Val_int(info->y));
Store_field(v_info, 1, Val_int(info->radius));
Store_field(v_info, 2, copy_double(info->zoom));
Store_field(v_info, 3, copy_double(info->momentum));
CAMLreturn(v_info);
}
示例6: val_of_result_e10
static inline value val_of_result_e10(gsl_sf_result_e10 *result)
{
CAMLparam0();
CAMLlocal3(r, v, e) ;
v = copy_double(result->val);
e = copy_double(result->err);
r = alloc_small(3, 0);
Field(r, 0) = v;
Field(r, 1) = e;
Field(r, 2) = Val_int(result->e10);
CAMLreturn(r);
}
示例7: sml_atan2
value sml_atan2(value f1, value f2)
{ double r, r1, r2;
float_exn = SYS__EXN_DOMAIN;
r1 = Double_val(f1);
r2 = Double_val(f2);
if (r1 == 0.0 && r2 == 0.0)
return copy_double(0.0);
r = atan2(r1, r2);
CHECK_FLOAT(r);
RAISE_FLOAT_IF( r != r );
return copy_double(r);
}
示例8: ml_gsl_monte_miser_get_params
CAMLprim value ml_gsl_monte_miser_get_params(value state)
{
CAMLparam0();
CAMLlocal1(r);
gsl_monte_miser_state *s = GSLMISERSTATE_VAL(state);
r=alloc_tuple(5);
Store_field(r, 0, copy_double(s->estimate_frac));
Store_field(r, 1, Val_int(s->min_calls));
Store_field(r, 2, Val_int(s->min_calls_per_bisection));
Store_field(r, 3, copy_double(s->alpha));
Store_field(r, 4, copy_double(s->dither));
CAMLreturn(r);
}
示例9: unix_mktime
CAMLprim value unix_mktime(value t)
{
struct tm tm;
time_t clock;
value res;
value tmval = Val_unit, clkval = Val_unit;
Begin_roots2(tmval, clkval);
tm.tm_sec = Int_val(Field(t, 0));
tm.tm_min = Int_val(Field(t, 1));
tm.tm_hour = Int_val(Field(t, 2));
tm.tm_mday = Int_val(Field(t, 3));
tm.tm_mon = Int_val(Field(t, 4));
tm.tm_year = Int_val(Field(t, 5));
tm.tm_wday = Int_val(Field(t, 6));
tm.tm_yday = Int_val(Field(t, 7));
tm.tm_isdst = -1; /* tm.tm_isdst = Bool_val(Field(t, 8)); */
clock = mktime(&tm);
if (clock == (time_t) -1) unix_error(ERANGE, "mktime", Nothing);
tmval = alloc_tm(&tm);
clkval = copy_double((double) clock);
res = alloc_small(2, 0);
Field(res, 0) = clkval;
Field(res, 1) = tmval;
End_roots ();
return res;
}
示例10: netcgi2_apache_request_request_time
CAMLprim value
netcgi2_apache_request_request_time (value rv)
{
CAMLparam1 (rv);
request_rec *r = Request_rec_val (rv);
CAMLreturn (copy_double ((double) r->request_time));
}
示例11: ml_gsl_multimin_fdfminimizer_minimum
CAMLprim value ml_gsl_multimin_fdfminimizer_minimum(value ox, value odx, value og, value T)
{
gsl_multimin_fdfminimizer *t=GSLMULTIMINFDFMINIMIZER_VAL(T);
if(Is_block(ox)) {
value x=Unoption(ox);
_DECLARE_VECTOR(x);
_CONVERT_VECTOR(x);
gsl_vector_memcpy(&v_x,
gsl_multimin_fdfminimizer_x(t));
}
if(Is_block(odx)) {
value dx=Unoption(odx);
_DECLARE_VECTOR(dx);
_CONVERT_VECTOR(dx);
gsl_vector_memcpy(&v_dx,
gsl_multimin_fdfminimizer_dx(t));
}
if(Is_block(og)) {
value g=Unoption(og);
_DECLARE_VECTOR(g);
_CONVERT_VECTOR(g);
gsl_vector_memcpy(&v_g,
gsl_multimin_fdfminimizer_gradient(t));
}
return copy_double(gsl_multimin_fdfminimizer_minimum(t));
}
示例12: push_vert
static void push_vert(value root, double x, double y, double z)
{
CAMLparam1(root);
CAMLlocal4(vert, xx, yy, zz);
value cons;
xx = copy_double(x); yy = copy_double(y); zz = copy_double(z);
vert = alloc_tuple(3);
Field(vert,0) = xx;
Field(vert,1) = yy;
Field(vert,2) = zz;
cons = alloc_tuple(2);
Field(cons, 0) = vert;
Field(cons, 1) = Field(root,0);
modify(&Field(root,0), cons);
CAMLreturn0;
}
示例13: c_double_of_indexed_bytes
value
c_double_of_indexed_bytes(value s, value index)
{
CAMLparam2 (s, index);
double *x = (double*)(String_val(s) + Int_val(index));
CAMLreturn (copy_double(*x));
}
示例14: Copyright
/*
$Id$
Copyright (C) 2004 Pascal Brisset, Antoine Drouin
Ocaml low level conversions
This file is part of paparazzi.
paparazzi is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
paparazzi is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with paparazzi; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <sys/types.h>
#include <fcntl.h>
#include <sys/termios.h>
#include <stdio.h>
#include <caml/mlvalues.h>
#include <caml/alloc.h>
#include <caml/memory.h>
#include <inttypes.h>
#ifdef ARCH_ALIGN_DOUBLE
value
c_float_of_indexed_bytes(value s, value index)
{
CAMLparam2 (s, index);
char *x = (char *)(String_val(s) + Int_val(index));
//Assert(sizeof(float) == 4);
union { char b[4]; float f; } buffer;
buffer.b[0] = x[0];
buffer.b[1] = x[1];
buffer.b[2] = x[2];
buffer.b[3] = x[3];
CAMLreturn (copy_double((double)buffer.f));
}
value
c_double_of_indexed_bytes(value s, value index)
{
CAMLparam2 (s, index);
char *x = (char *)(String_val(s) + Int_val(index));
//Assert(sizeof(double) == 8);
union { char b[sizeof(double)]; double d; } buffer;
int i;
for (i=0; i < sizeof(double); i++) {
buffer.b[i] = x[i];
}
CAMLreturn (copy_double(buffer.d));
}
#else /* no ARCH_ALIGN_DOUBLE */
value
c_float_of_indexed_bytes(value s, value index)
{
CAMLparam2 (s, index);
float *x = (float*)(String_val(s) + Int_val(index));
CAMLreturn (copy_double((double)(*x)));
}
示例15: sml_exp
value sml_exp(value f)
{ double r;
float_exn = SYS__EXN_OVERFLOW;
r = exp(Double_val(f));
CHECK_FLOAT(r);
return copy_double(r);
}