Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
34 user(s) are online (27 user(s) are browsing Forums)

Members: 1
Guests: 33

AmigaSociety, more...

Headlines

Forum Index


Board index » All Posts (yescop)




Re: gcc bug or am I a looser?
Just popping in
Just popping in


@broadblues and all

In the meantime, I wrote this code. May be for someone it is overkill but it works well. Your solution using int is a good idea but not suitable in my case.

Here is the code for all who wants to know and feel to use it freely.
It is in C++

template <class T>
bool AmawIn(const T a, const T b,const T c) {

T bb=b,cc=c;
T eps std::numeric_limits<T>::epsilon()*100;
    if (
c) { T tmp=bbbb cccc tmp;}
    if ( (
a>bb) && (a<cc)) return true;
    if ( (
fabs(a-bb) < eps) || (fabs(cc-a) < eps) ) return true;
    return 
false;
}


Capehill, I had understood your purpose and used this to display the numbers
cout <<std::fixed<<std::setprecision(16)<<"(Amawin:: a="<<a<<" b="<<bb<<" c="<<cc<<" epsilon="<<eps<<")"<<endl;

Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top


Re: gcc bug or am I a looser?
Just popping in
Just popping in


@yescop
Thanks for taking time to read my source and answer.

Capehill, the precision is 16 (using double).
Broadblues, I am not a looser but a too confident person.
I was thinking wrongly that the comparison in gcc was smarter.
For example, if a=1.0 and b=1.0, a==b would always return true.
But it is not true because the comparison will examine all digits (here 16) and not only a few (here only one digit, smarter as the variables used in my code were equal to numbers from 1 to 4 with a step of 0.2) and as you wrote, the conversion is not precise.

Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top


gcc bug or am I a looser?
Just popping in
Just popping in


Hi everybody,

I was testing a part of my code when I discovered something strange.
I was testing (function AmawIn) if a variable a is within a range [b,c] and when a was equal to b or c the result could be false.
Changing the types worked but not always. I changed the code testing different algorithms of AmawIn as you can read.
I am using gcc 11.3 (the last adtools). For info, I have just compiled the code with gcc Debian 11.3 with the same output.
After testing a lot, I have got no more ideas.
I hope someone will help me.
I compile with
Quote:
g++ -std=c++11 -athread=native -o test-anim test-anim.cc

Here is the code.
#include <iostream>
#include <cmath>
#include <exec/types.h>
using namespace std;
/*
template <class T>
bool AmawIn(const T a, const T b,const T c) {

//T aa=a,bb=b,cc=c;
//    if (b > c) { T tmp=bb; bb = cc; cc = tmp;}
    return !(a<b) && !(c<a);
}
*/

/*
bool AmawIn(float64 a, float64 b, float64 c) {

    if ( ( ( a >= b) &&  (a <= c)) || (( a >= c) && ( a <= b)) ) return true;
        else { cout <<"Inside AmawiI ( a="<<a<<" b="<<b<<" c="<<c<<")"<<endl;
        return false; 
    }
}
*/

/*
bool AmawIn(const float64 a, const float64 b,const float64 c) {

//T aa=a,bb=b,cc=c;
//    if (b > c) { T tmp=bb; bb = cc; cc = tmp;}
    return !(a<b) && !(c<a);
}

*/

bool AmawIn(const float64 a, const float64 b,const float64 c) {

    return !(
a<b) && !(c<a);
}

int main(int argcchar *argv[]) {

    
bool stopp false;
    
bool back true;
    
bool infinite false;

    
float64 animold;
    
int32 compteur 0;

    
int32 animt 1;
    
float64 animS 1.;
    
float64 animE 4.;
    
float64 animV 0.2;
    
float64 animSnew animS;
    
float64 animEnew animE;
    
float64 anim;

    
int32 delay1;
    
int32 delay2;
    
int32 delay3;

    if (
animV>=1) {
        
delay1 delay2 delay3 0;
    } else {
            
delay1 static_cast<int>( 1./(animV*2));
            
delay2 static_cast<int>( -1.+1./animV);
            
delay3 static_cast<int>( 1./animV);
    }

    if (
animV == 0.5delay2 2;
    if (
backanimt 2;
    if (
animS>animEanimV *= -1;

    if (
back) {
        if (
animS<animEanimEnew =animE delay1 animV;
        if (
animS>animEanimSnew animS delay2 animV;
    }

    
anim animSnew;
    
cout <<endl<<"    (animS = "<<animS<<", animE = "<<animE<<", animV = "<<animV<<")";
    
cout <<endl<<"    (animS = "<<animSnew<<", animE = "<<animEnew<<", animV = "<<animV<<")"<<endl;

    for (
int i=0; (i<1000) && !stopp; ++i) {

        if (
i%12==0cout <<endl;

        
animold anim;
        
cout <<anim<<", ";

        if (
animt 0) {
            
anim += animV;
            if (!
AmawIn(animanimSnewanimEnew ) ) {    //[color=FF6600]HERE IS THE PROBLEM[/color]
                
cout <<"( in AmawIn: "<<anim<<" not in "<<animSnew<<":"<<animEnew<<")"<<endl;

                if ( 
fabs(anim-animSnew) < fabs(anim-animEnew) ) anim animS;
                    else 
anim animE;

                if (!
infinite) --animt;
                if (
back) {
                    
animV*=-1;
                    if (
animt>0) {
                        if (
animS<animEanim =animEnew animV;
                        if (
animS>animEanim animE delay3 animV;
                    }
                    
cout <<endl<<endl<<"    back commencé (animS = "<<animSnew<<", animE = "<<animEnew<<", animV = "<<animV<<")"<<endl;
                } else if ( (
animt>1) || ( (animt==1) && infinite ) )     anim animS;
            }
        }

        if (
anim==animold) ++compteur;

        if (
compteur4stopp true;
    }
    
cout <<endl;

return 
0;
}



Here is the output
(animS 1animE 4animV 0.2)
    (
animS 1animE 4.4animV 0.2)

11.21.41.61.822.22.42.62.833.2
3.43.63.844.2, ( in AmawIn4.4 not in 1:4.4//[color=FF6600]HERE IS THE PROBLEM[/color]


    
back commencé (animS 1animE 4.4animV = -0.2)
4.243.83.63.43.23
2.82.62.42.221.81.61.41.2, ( in AmawIn1 not in 1:4.4//[color=FF6600]HERE IS THE PROBLEM[/color]


    
back commencé (animS 1animE 4.4animV 0.2)
111
11,

Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top


Re: gcc 9 and 10
Just popping in
Just popping in


@Capehill

Thanks for your help.
I will give my first impressions.
At first I tested gcc10 and gcc09 without success.
Too many errors even with -std=c++11 -mcrt=...
I managed to get my progs compiled with gcc09 with
-std=c++11 -athread=native (or something like that not sure of the syntax).

I compiled a hello prog and a more complex amiga program with sucess.
I notice a problem though.
In one .cc file (located in work:dir2 ) I declared an include like #include "work:dir/file.h"

I had an error during compilation
File not found work:dir2/work:dir/file.h
As you see, there is a bug here.

For the moment, I change the include by /work/dir/file.h in the linux way. I don't really like it.


Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top


Re: gcc 9 and 10
Just popping in
Just popping in


Hello
All of you are doing a great job.
I would test gcc 10 on OS4.1.
What and where do I download? (gcc, addtools...)
How to install it? over old gcc or fresh install? In this case, all libraries and .so must be reinstalled, no?
Thanks for your answers.

Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top


Re: Burn the copy of amigaos 4.1
Just popping in
Just popping in


@white
Simple answer, no.
Don't forget to check the option "disk bootable" or something like that in your software.

Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top


Re: how PPC Cpu handle "double" and "float" in terms of speed
Just popping in
Just popping in


@kas1e
In your double function, you didn't cast the constants to double as you did in float function.
So I think there is an implicit conversion and this costs time.
Change your double function to
Rv += 2d/(i(i+2))
And see the difference with float function and old double function.

Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top


Re: SketchBlock Pro Installation Video And Icon Editing Demo
Just popping in
Just popping in


@daveyw
When I had this kind of problem (no boot of workbench),
I used my os4 cd installation to boot up and open a shell.
There, you can copy or modified your files or your prefs on your disk.

Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top


Re: SketchBlock Pro Installation Video
Just popping in
Just popping in


@broadblues
Thanks for the last vieo. I saw some demonstration of what I asked for.
Keep doing tutorials as I love them.

Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top


Re: SketchBlock Pro Installation Video
Just popping in
Just popping in


@broadblues
Thanks for your work and your simple and efficiency answer.
I saw your video and i don't understand why you created a screen and palette. In the prefs menu of sb, there isn't an option to choose "open sb on a screen"?
It is the choice of the palette which disturbs me. Does sb not choose the palette by default?

It seems that I choose my gift for christmas...

Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top


Re: SketchBlock Pro Installation Video
Just popping in
Just popping in


@broadblues
A few months ago, I asked you what you can do with Sketchblock.
I read your site and there are some new things in the last version of SB.
But are there functions to manipulate two or more images? Merge them, composite them, use image alpha...
In photogenics, there are tools like smudge and smear. Do they exist in SB?
I saw an interesting video on youtube about photoshop.
In it, the author removed an object like a car from the scene. Could I do this in SB?
Last question, I suppose that a paint tablet (not sure for the name) is not mandatory.

Thanks for reading. I was supposed to ask only one question and there are more!
YesCop


Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top


Re: Strange crash
Just popping in
Just popping in


@Raziel

I have just typed this.
version libs:mpega.library

and I obtain (only) so that should not be the same file.
mpega.library 2.4

Its size is 215 109 492 bytes.

I am on OS4.1 FE.

Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top


Re: Project StartFighter 1.7
Just popping in
Just popping in


Hello.
I will enjoy helping you.
I have a sam flex and a radeon 9250.

Cheers,
Jesús

Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top


Re: When will Amigakit sell X5000?
Just popping in
Just popping in


As Lemen, I would want to know too when the 5040 will be there even it is not for now.
I think it is normal to know from amigakit or AEon if these computers are not discarded.
I hope we will have an answer.

Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top


Re: Video: Creating Video Titles in SketchBlock Pro
Just popping in
Just popping in


@broadblues

Thanks. It is a good question andvthe answer is ard.
I have to think about that.
Would it be all (almost) possible with version 2.6, 2.8 or 3.1?

Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top


Re: Video: Creating Video Titles in SketchBlock Pro
Just popping in
Just popping in


@broadblues

As always, I like your videos. This time I had the oportunity to hear your music. Good.

In this video, it seems that sk is more than a paint program. Could I do all I can do with Photogenics?

Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top


Re: AmiWest news
Just popping in
Just popping in


What I wanted to know from the Amiwest show is when Aeon will make the 5040.
Is it allready completely designed? Is a batch scheduled?

Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top


Re: Interested in learning OpenGL ES 2 or Warp3D Nova?
Just popping in
Just popping in


@Hans

Thanks for your tutorials. They are simple and well explained. Nova seems to be simpler that I could imagined.
I am interested in your future tutorials even I don't fill your survey because I don't want to buy a new hd card for my sam flex. May be yes if I buy a 5040.

Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top


Re: Dungeon crawler
Just popping in
Just popping in


@all

Here is a new demo. Enjoy
https://www.youtube.com/watch?v=LkQ3VzKgd5w

Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top


Re: HELP!!!!
Just popping in
Just popping in


Mike,
I will format the boot system to ffs as some old machines didn't boot ir not correctly with sfs (like pegasos).
I don't know if it isthe case with micro

Since a lot of months without an amiga to love, I was lost.
Now I feel happiness again with a Sam Flex 800 .
Go to top



TopTop
(1) 2 3 4 ... 9 »




Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project