Back to index

plt-scheme  4.2.1
fmod.c File Reference
#include "escheme.h"
#include <math.h>

Go to the source code of this file.


static Scheme_Objectsch_fmod (int argc, Scheme_Object **argv)
Scheme_Objectscheme_reload (Scheme_Env *env)
Scheme_Objectscheme_initialize (Scheme_Env *env)
Scheme_Objectscheme_module_name ()

Function Documentation

static Scheme_Object* sch_fmod ( int  argc,
Scheme_Object **  argv 
) [static]

Definition at line 14 of file fmod.c.

  /* Because we'll use scheme_make_prim_w_arity, MzScheme will
     have already checked that we're getting the right number of
     arguments. */
  Scheme_Object *a = argv[0], *b = argv[1];
  double v;

  /* Make sure we got real numbers, and complain if not: */
  if (!SCHEME_REALP(a))
    scheme_wrong_type("fmod", "real number", 0, argc, argv);
  /*                       1st arg wrong ----^ */
  if (!SCHEME_REALP(b))
    scheme_wrong_type("fmod", "real number", 1, argc, argv);
  /*                       2nd arg wrong ----^ */

  /* Convert the Scheme numbers to double-precision floating point
     numbers, and compute fmod: */
  v = fmod(scheme_real_to_double(a),

  /* Return the result, packaging it as a Scheme value: */
  return scheme_make_double(v);

Here is the caller graph for this function:

Definition at line 66 of file fmod.c.

  /* First load is same as every load: */
  return scheme_reload(env);

Here is the call graph for this function:

Definition at line 72 of file fmod.c.

  /* This extension doesn't define a module: */
  return scheme_false;

Definition at line 41 of file fmod.c.

  Scheme_Object *proc;

  /* The MZ_GC... lines are for for 3m, because env is live across an
     allocating call. They're not needed for plain old (conservatively
     collected) Mzscheme. See makeadder3m.c for more info. */
  MZ_GC_VAR_IN_REG(0, env);

  /* Package the C implementation of fmod into a Scheme procedure
     value: */
  proc = scheme_make_prim_w_arity(sch_fmod, "fmod", 2, 2);
  /*               Requires at least two args ------^  ^ */
  /*                  Accepts no more than two args ---| */

  /* Define `fmod' as a global :*/
  scheme_add_global("fmod", proc, env);


  return scheme_void;

Here is the call graph for this function: