<?php
	require ("./Funciones/funciones.php");
	require("conexion.php");
	$conexion = conecta();
	$ancho = $_POST['ancho'];
	$largo = $_POST['largo'];
	$med = $_POST['med'];
	function round_up ( $value, $precision ) { 
    $pow = pow ( 10, $precision ); 
    return ( ceil ( $pow * $value ) + ceil ( $pow * $value - ceil ( $pow * $value ) ) ) / $pow; 
} 
	if($med == 1){
		$anchomts = ($ancho * 0.0254)+0.02;
		$largomts = ($largo * 0.0254)+0.02;
		/*$anchomts = round_up($anchomts,2);
		$largomts = round_up($largomts,2);*/
		$area = $anchomts * $largomts;
		$area = round_up($area,5);
	}else if($med == 2){
		$anchomts = $ancho/100;
		$largomts = $largo/100;
		$area = $anchomts * $largomts;
		$area = round_up($area,5);
	}

	echo $area;
?>