<commit_before>#include <stdio.h>
#include <string.h>
#include "object.h"
#include "cons.h"
#include "symtab.h"
#include "common.h"
#include "eval.h"

/* Maths */
object_t *addition (object_t * lst)
{
  REQM (lst, 1, c_sym ("+"));
  double accum = 0;
  int intmode = 1;
  object_t *p = lst;
  while (p != NIL)
    {
      if (CAR (p)->type == FLOAT)
	{
	  intmode = 0;
	  accum += OFLOAT (CAR (p));
	}
      else if (CAR (p)->type == INT)
	accum += OINT (CAR (p));
      else
	THROW (wrong_type, UPREF (CAR (p)));
      p = CDR (p);
    }
  if (intmode)
    return c_int ((int) accum);
  return c_float ((double) accum);
}

object_t *multiply (object_t * lst)
{
  REQM (lst, 1, c_sym ("*"));
  double accum = 1;
  int intmode = 1;
  object_t *p = lst;
  while (p != NIL)
    {
      if (CAR (p)->type == FLOAT)
	{
	  intmode = 0;
	  accum *= OFLOAT (CAR (p));
	}
      else if (CAR (p)->type == INT)
	accum *= OINT (CAR (p));
      else
	THROW (wrong_type, UPREF (CAR (p)));
      p = CDR (p);
    }
  if (intmode)
    return c_int ((int) accum);
  return c_float ((double) accum);
}

object_t *subtract (object_t * lst)
{
  REQM (lst, 1, c_sym ("-"));
  object_t *p = lst;
  double accum = 0;
  int intmode = 1;
  if (CAR (p)->type == INT)
    accum = OINT (CAR (p));
  else if (CAR (p)->type == FLOAT)
    {
      intmode = 0;
      accum = OFLOAT (CAR (p));
    }

  p = CDR (p);
  while (p != NIL)
    {
      if (CAR (p)->type == FLOAT)
	{
	  intmode = 0;
	  accum -= OFLOAT (CAR (p));
	}
      else if (CAR (p)->type == INT)
	accum -= OINT (CAR (p));
      else
	THROW (wrong_type, UPREF (CAR (p)));
      p = CDR (p);
    }
  if (intmode)
    return c_int ((int) accum);
  return c_float ((double) accum);
}

object_t *divide (object_t * lst)
{
  REQM (lst, 1, c_sym ("/"));
  object_t *p = lst;
  double accum = 0;
  int intmode = 1;
  if (CAR (p)->type == INT)
    accum = OINT (CAR (p));
  else if (CAR (p)->type == FLOAT)<commit_msg>Removed unneeded and wrong checks in lisp.c.<commit_after>#include <stdio.h>
#include <string.h>
#include "object.h"
#include "cons.h"
#include "symtab.h"
#include "common.h"
#include "eval.h"

/* Maths */
object_t *addition (object_t * lst)
{
  double accum = 0;
  int intmode = 1;
  object_t *p = lst;
  while (p != NIL)
    {
      if (CAR (p)->type == FLOAT)
	{
	  intmode = 0;
	  accum += OFLOAT (CAR (p));
	}
      else if (CAR (p)->type == INT)
	accum += OINT (CAR (p));
      else
	THROW (wrong_type, UPREF (CAR (p)));
      p = CDR (p);
    }
  if (intmode)
    return c_int ((int) accum);
  return c_float ((double) accum);
}

object_t *multiply (object_t * lst)
{
  double accum = 1;
  int intmode = 1;
  object_t *p = lst;
  while (p != NIL)
    {
      if (CAR (p)->type == FLOAT)
	{
	  intmode = 0;
	  accum *= OFLOAT (CAR (p));
	}
      else if (CAR (p)->type == INT)
	accum *= OINT (CAR (p));
      else
	THROW (wrong_type, UPREF (CAR (p)));
      p = CDR (p);
    }
  if (intmode)
    return c_int ((int) accum);
  return c_float ((double) accum);
}

object_t *subtract (object_t * lst)
{
  object_t *p = lst;
  double accum = 0;
  int intmode = 1;
  if (CAR (p)->type == INT)
    accum = OINT (CAR (p));
  else if (CAR (p)->type == FLOAT)
    {
      intmode = 0;
      accum = OFLOAT (CAR (p));
    }

  p = CDR (p);
  while (p != NIL)
    {
      if (CAR (p)->type == FLOAT)
	{
	  intmode = 0;
	  accum -= OFLOAT (CAR (p));
	}
      else if (CAR (p)->type == INT)
	accum -= OINT (CAR (p));
      else
	THROW (wrong_type, UPREF (CAR (p)));
      p = CDR (p);
    }
  if (intmode)
    return c_int ((int) accum);
  return c_float ((double) accum);
}

object_t *divide (object_t * lst)
{
  object_t *p = lst;
  double accum = 0;
  int intmode = 1;
  if (CAR (p)->type == INT)
    accum = OINT (CAR (p));
  else if (CAR (p)->type == FLOAT)
{'fraction_non_alphanumeric': 0.1879441958410108, 'fraction_numerical': 0.007370360621216109, 'mean_word_length': 2.4141958670260557, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1226764', 'n_tokens_mistral': 1715, 'n_tokens_neox': 1606, 'n_words': 471}