avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] FP Lib Testing


From: Colin O'Flynn
Subject: [avr-libc-dev] FP Lib Testing
Date: Tue, 4 Jan 2005 22:40:05 -0400
User-agent: KMail/1.7.1

Hello,

I was fooling around a bit with the Paranoia floating-point test suite (see 
http://www.netlib.org/paranoia/index.html) - changing it to run on the AVR. 
It is pretty simple, mostly just some printf() changes to move strings from 
RAM to FLASH.

So far looks good, though haven't got all the tests to run. One thing is that  
0/0 results in 2, shouldn't this be NaN? Or is this a problem of the printf() 
statement not supporting NaN?

You can see the test code I used below to confirm this result.

Regards,

 -Colin


Addendix: Sample test code for cases mentioned

#include <stdio.h>
#include <math.h>
#include <avr/io.h>
#include <avr/pgmspace.h>

//115.2Kbaud at 3.68 MHz crystal
#define init_printf() UBRR0L = 1; UCSR0B |= 1<<TXEN0; fdevopen(uputchar,0,0)

int
   uputchar(char c)
    {

      if (c == '\n')
        uputchar('\r');
      loop_until_bit_is_set(UCSR0A, UDRE0);
      UDR0 = c;
      return 0;
    }
    
int main (void)
 {
 volatile float a,b,c;
 
 init_printf();
 
 a = 0;
 
 b = 0
 
 c = a / b;
 
 printf("a is %f \n", a);
 printf("b is %f \n", b);
 printf("c is %f \n", c);
 
 return 0;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]