post-scarcity/src/arith/real.c
Simon Brooke 93d4bd14a0
Generally, changed working with tags as strings to as values.
This seems both cheaper and safer; what's not to like?
2021-08-17 16:09:00 +01:00

30 lines
735 B
C

/*
* real.c
*
* functions for real number cells.
*
* (c) 2017 Simon Brooke <simon@journeyman.cc>
* Licensed under GPL version 2.0, or, at your option, any later version.
*/
#include "conspage.h"
#include "consspaceobject.h"
#include "debug.h"
#include "read.h"
/**
* Allocate a real number cell representing this value and return a cons
* pointer to it.
* @param value the value to wrap;
* @return a real number cell wrapping this value.
*/
struct cons_pointer make_real( long double value ) {
struct cons_pointer result = allocate_cell( REALTV );
struct cons_space_object *cell = &pointer2cell( result );
cell->payload.real.value = value;
debug_dump_object( result, DEBUG_ARITH );
return result;
}