/*
 * sqrt.c
 *
 *  Created on: 16-02-2017
 *      Author: Krzysztof Jakubczyk
 */

#include <math.h>

#include "tdefs.h"
#include "misc.h"

#include "helper.h"
#include "sqrt.h"

int sqrt_initlog(void *arguments, void *logic)
{
	struct sqrt_args *args = (struct sqrt_args *)arguments;
	struct sqrt_logic *log = (struct sqrt_logic *)logic;

	if(set_float_ptr(args->io.in_float_in,&log->fin))
		return -1;

	if(set_float_ptr(args->io.out_float_out,&log->fout))
		return -1;

	return 0;
}

void sqrt_(void *arguments, void *logic)
{
	struct sqrt_logic *log = (struct sqrt_logic *)logic;

	*log->fout=sqrtf(*log->fin);
}
