/****************************************************************************/ /* (C) Copyright 1993 Universidade Estadual de Campinas (UNICAMP) */ /* Campinas, SP, Brazil */ /* */ /* This file can be freely distributed, modified, and used for any */ /* non-commercial purpose, provided that this copyright and authorship */ /* notice be included in any copy or derived version of this file. */ /* */ /* DISCLAIMER: This software is offered ``as is'', without any guarantee */ /* as to fitness for any particular purpose. Neither the copyright */ /* holder nor the authors or their employers can be held responsible for */ /* any damages that may result from its use. */ /****************************************************************************/ char *aat_gtag = "g12"; char *aat_gname = "y = [x]+2;\nd = x-y;\nt = d(1-d^2)/4; h = t/(1+t^2);\nu = x+h; v = x+h;\nm = u^2 + v^2 + 2uv; f = m - 1/4\ng=m"; Float aat_f_flt (Float x, Float y); Interval aat_f_ia (Interval x, Interval y); AAP aat_f_aa (AAP x, AAP y); Float aat_f_flt (Float x, Float y) { ROUND_NEAR; { Float d = x - y; Float t = Quarter * d * (One - d*d); Float h = t / (1 + t*t); Float u = x + h; Float v = y + h; Float u2 = u*u; Float v2 = v*v; Float uv = u*v; Float m = u2 + v2 + uv + uv; Float res = m - Quarter; return (res); } } Float aat_g_flt (Float x) { ROUND_NEAR; { Float y = x + Two; Float res = aat_f_flt(x, y); return (res); } } Interval aat_f_ia (Interval x, Interval y) { Interval d = ia_sub(x, y); Interval t = ia_mul(d, ia_affine(ia_sqr(d), -One, Four, Quarter, Zero)); Interval h = ia_div(t, ia_shift(ia_sqr(t), One)); Interval u = ia_add(x, h); Interval v = ia_add(y, h); Interval u2 = ia_sqr(u); Interval v2 = ia_sqr(v); Interval uv = ia_mul(u, v); Interval m = ia_add(ia_add(u2, v2), ia_add(uv, uv)); Interval res = ia_shift(m, -Quarter); return (res); } Interval aat_g_ia (Interval x) { Interval y = ia_shift(x, Two); Interval res = aat_f_ia(x, y); return (res); } AAP aat_f_aa (AAP x, AAP y) { AAP d = aa_sub(x, y); AAP t = aa_mul(d, aa_affine(aa_sqr(d), -One, Four, Quarter, Zero)); AAP h = aa_div(t, aa_shift(aa_sqr(t), One)); AAP u = aa_add(x, h); AAP v = aa_add(y, h); AAP u2 = aa_sqr(u); AAP v2 = aa_sqr(v); AAP uv = aa_mul(u, v); AAP m = aa_add(aa_add(u2, v2), aa_add(uv, uv)); AAP res = aa_shift(m, -Quarter); return (res); } AAP aat_g_aa (AAP x) { MemP frame = aa_top(); AAP y = aa_shift(aa_from_interval(aa_range(x)), Two); AAP res = aat_f_aa(x, y); return (aa_return(frame, res)); } Interval aat_gxd = {-Four, Four}; Interval aat_gyd = {-2.0, 6.0}; int aat_gn = 8;